text: /**
   * Modules in this bundle
   * @license
   *
   * a-table:
   *   license: MIT (http://opensource.org/licenses/MIT)
   *   author: appleple
   *   version: 1.5.9
   *
   * a-template:
   *   license: MIT (http://opensource.org/licenses/MIT)
   *   author: steelydylan
   *   version: 0.5.4
   *
   * base64-js:
   *   license: MIT (http://opensource.org/licenses/MIT)
   *   author: T. Jameson Little <t.jameson.little@gmail.com>
   *   homepage: https://github.com/beatgammit/base64-js
   *   version: 1.3.0
   *
   * buffer:
   *   license: MIT (http://opensource.org/licenses/MIT)
   *   author: Feross Aboukhadijeh <feross@feross.org>
   *   contributors: Romain Beauxis <toots@rastageeks.org>, James Halliday <mail@substack.net>
   *   homepage: https://github.com/feross/buffer
   *   version: 4.9.1
   *
   * clone:
   *   license: MIT (http://opensource.org/licenses/MIT)
   *   author: Paul Vorbach <paul@vorba.ch>
   *   contributors: Blake Miner <miner.blake@gmail.com>, Tian You <axqd001@gmail.com>, George Stagas <gstagas@gmail.com>, Tobiasz Cudnik <tobiasz.cudnik@gmail.com>, Pavel Lang <langpavel@phpskelet.org>, Dan MacTough, w1nk, Hugh Kennedy, Dustin Diaz, Ilya Shaisultanov, Nathan MacInnes <nathan@macinn.es>, Benjamin E. Coe <ben@npmjs.com>, Nathan Zadoks, Róbert Oroszi <robert+gh@oroszi.net>, Aurélio A. Heckert, Guy Ellis, fscherwi, rictic, Martin Jurča, Misery Lee <miserylee@foxmail.com>, Clemens Wolff
   *   homepage: https://github.com/pvorb/node-clone#readme
   *   version: 2.1.2
   *
   * custom-event-polyfill:
   *   license: MIT (http://opensource.org/licenses/MIT)
   *   contributors: Frank Panetta, Mikhail Reenko <reenko@yandex.ru>, Joscha Feth <joscha@feth.com>
   *   homepage: https://github.com/krambuhl/custom-event-polyfill#readme
   *   version: 0.3.0
   *
   * deep-extend:
   *   license: MIT (http://opensource.org/licenses/MIT)
   *   licenses: MIT (http://opensource.org/licenses/MIT)
   *   author: Viacheslav Lotsmanov <lotsmanov89@gmail.com>
   *   contributors: Romain Prieto, Max Maximov, Marshall Bowers, Misha Wakerman
   *   homepage: https://github.com/unclechu/node-deep-extend
   *   version: 0.5.1
   *
   * ie-array-find-polyfill:
   *   license: MIT (http://opensource.org/licenses/MIT)
   *   author: Carlos Abdalla
   *   homepage: https://github.com/abdalla/ie-array-find-polyfill#readme
   *   version: 1.1.0
   *
   * ieee754:
   *   license: BSD-3-Clause (http://opensource.org/licenses/BSD-3-Clause)
   *   author: Feross Aboukhadijeh <feross@feross.org>
   *   contributors: Romain Beauxis <toots@rastageeks.org>
   *   homepage: https://github.com/feross/ieee754#readme
   *   version: 1.1.12
   *
   * isarray:
   *   license: MIT (http://opensource.org/licenses/MIT)
   *   author: Julian Gruber <mail@juliangruber.com>
   *   homepage: https://github.com/juliangruber/isarray
   *   version: 1.0.0
   *
   * morphdom:
   *   license: MIT (http://opensource.org/licenses/MIT)
   *   author: Patrick Steele-Idem <pnidem@gmail.com>
   *   homepage: https://github.com/patrick-steele-idem/morphdom#readme
   *   version: 2.3.3
   *
   * This header is generated by licensify (https://github.com/twada/licensify)
   */
  !function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.aTable=t()}}(function(){return function(){function t(e,n,r){function o(i,l){if(!n[i]){if(!e[i]){var s="function"==typeof require&&require;if(!l&&s)return s(i,!0);if(a)return a(i,!0);var c=new Error("Cannot find module '"+i+"'");throw c.code="MODULE_NOT_FOUND",c}var u=n[i]={exports:{}};e[i][0].call(u.exports,function(t){return o(e[i][1][t]||t)},u,u.exports,t,e,n,r)}return n[i].exports}for(var a="function"==typeof require&&require,i=0;i<r.length;i++)o(r[i]);return o}return t}()({1:[function(t,e,n){"use strict";function r(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var a=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}();t("ie-array-find-polyfill");var i=t("morphdom"),l=function(t){return t&&t.__esModule?t:{default:t}}(i),s=t("./util"),c="input paste copy click change keydown keyup keypress contextmenu mouseup mousedown mousemove touchstart touchend touchmove compositionstart compositionend focus",u=c.replace(/([a-z]+)/g,"[data-action-$1],")+"[data-action]",f=function(){function t(e){var n=this;o(this,t),this.atemplate=[],e&&Object.keys(e).forEach(function(t){n[t]=e[t]}),this.data||(this.data={}),this.templates||(this.templates=[]);for(var r=this.templates,a=r.length,i=0,l=a;i<l;i+=1){var c=this.templates[i],u=(0,s.selector)("#"+c).innerHTML;this.atemplate.push({id:c,html:u,binded:!1})}}return a(t,[{key:"addDataBind",value:function(t){var e=this;(0,s.on)(t,"[data-bind]","input change click",function(t){var n=t.delegateTarget,r=n.getAttribute("data-bind"),o=n.getAttribute("href"),a=n.value;o&&(a=a.replace("#","")),"checkbox"===n.getAttribute("type")?function(){var t=[],e=document.querySelectorAll('[data-bind="'+r+'"]');[].forEach.call(e,function(e){e.checked&&t.push(e.value)})}():"radio"!==n.getAttribute("type")&&e.updateDataByString(r,a)})}},{key:"addActionBind",value:function(t){var e=this;(0,s.on)(t,u,c,function(t){var n=t.delegateTarget,o=c.split(" "),a="action";o.forEach(function(e){n.getAttribute("data-action-"+e)&&t.type===e&&(a+="-"+e)});var i=n.getAttribute("data-"+a);if(i){var l=i.replace(/\(.*?\);?/,""),s=i.replace(/(.*?)\((.*?)\);?/,"$2"),u=s.split(",");if(e.e=t,e.method&&e.method[l]){var f;(f=e.method)[l].apply(f,r(u))}else e[l]&&e[l].apply(e,r(u))}})}},{key:"addTemplate",value:function(t,e){this.atemplate.push({id:t,html:e,binded:!1}),this.templates.push(t)}},{key:"getData",value:function(){return JSON.parse(JSON.stringify(this.data))}},{key:"saveData",value:function(t){var e=JSON.stringify(this.data);localStorage.setItem(t,e)}},{key:"setData",value:function(t){var e=this;Object.keys(t).forEach(function(n){"function"!=typeof t[n]&&(e.data[n]=t[n])})}},{key:"loadData",value:function(t){var e=JSON.parse(localStorage.getItem(t));e&&this.setData(e)}},{key:"getRand",value:function(t,e){return~~(Math.random()*(e-t+1))+t}},{key:"getRandText",value:function(t){for(var e="",n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r=n.length,o=0;o<t;o+=1)e+=n.charAt(Math.floor(this.getRand(0,r)));return e}},{key:"getDataFromObj",value:function(t,e){t=t.replace(/\[([\w\-\.ぁ-んァ-ヶ亜-熙]+)\]/g,".$1"),t=t.replace(/^\./,"");for(var n=t.split(".");n.length;){var r=n.shift();if(!(r in e))return null;e=e[r]}return e}},{key:"getDataByString",value:function(t){var e=this.data;return this.getDataFromObj(t,e)}},{key:"updateDataByString",value:function(t,e){for(var n=this.data,r=t.split(".");r.length>1;)n=n[r.shift()];n[r.shift()]=e}},{key:"removeDataByString",value:function(t){for(var e=this.data,n=t.split(".");n.length>1;)e=e[n.shift()];var r=n.shift();r.match(/^\d+$/)?e.splice(Number(r),1):delete e[r]}},{key:"resolveBlock",value:function(t,e,n){var r=this,o=t.match(/<!-- BEGIN ([\w\-\.ぁ-んァ-ヶ亜-熙]+):touch#([\w\-\.ぁ-んァ-ヶ亜-熙]+) -->/g),a=t.match(/<!-- BEGIN ([\w\-\.ぁ-んァ-ヶ亜-熙]+):touchnot#([\w\-\.ぁ-んァ-ヶ亜-熙]+) -->/g),i=t.match(/<!-- BEGIN ([\w\-\.ぁ-んァ-ヶ亜-熙]+):exist -->/g),l=t.match(/<!-- BEGIN ([\w\-\.ぁ-んァ-ヶ亜-熙]+):empty -->/g);if(o)for(var s=0,c=o.length;s<c;s+=1){var u=o[s];u=u.replace(/([\w\-\.ぁ-んァ-ヶ亜-熙]+):touch#([\w\-\.ぁ-んァ-ヶ亜-熙]+)/,"($1):touch#($2)");var f=u.replace(/BEGIN/,"END"),h=new RegExp(u+"(([\\n\\r\\t]|.)*?)"+f,"g");t=t.replace(h,function(t,n,o,a){return""+("function"==typeof e[n]?e[n].apply(r):r.getDataFromObj(n,e))===o?a:""})}if(a)for(var d=0,p=a.length;d<p;d+=1){var g=a[d];g=g.replace(/([\w\-\.ぁ-んァ-ヶ亜-熙]+):touchnot#([\w\-\.ぁ-んァ-ヶ亜-熙]+)/,"($1):touchnot#($2)");var v=g.replace(/BEGIN/,"END"),y=new RegExp(g+"(([\\n\\r\\t]|.)*?)"+v,"g");t=t.replace(y,function(t,n,o,a){return""+("function"==typeof e[n]?e[n].apply(r):r.getDataFromObj(n,e))!==o?a:""})}if(i)for(var w=0,b=i.length;w<b;w+=1){var m=i[w];m=m.replace(/([\w\-\.ぁ-んァ-ヶ亜-熙]+):exist/,"($1):exist");var x=m.replace(/BEGIN/,"END"),E=new RegExp(m+"(([\\n\\r\\t]|.)*?)"+x,"g");t=t.replace(E,function(t,n,o){var a="function"==typeof e[n]?e[n].apply(r):r.getDataFromObj(n,e);return a||0===a?o:""})}if(l)for(var C=0,A=l.length;C<A;C+=1){var k=l[C];k=k.replace(/([\w\-\.ぁ-んァ-ヶ亜-熙]+):empty/,"($1):empty");var B=k.replace(/BEGIN/,"END"),N=new RegExp(k+"(([\\n\\r\\t]|.)*?)"+B,"g");t=t.replace(N,function(t,n,o){var a="function"==typeof e[n]?e[n].apply(r):r.getDataFromObj(n,e);return a||0===a?"":o})}return t=t.replace(/{([\w\-\.ぁ-んァ-ヶ亜-熙]+)}(\[([\w\-\.ぁ-んァ-ヶ亜-熙]+)\])*/g,function(t,o,a,i){var l=void 0;if(""+o=="i")l=n;else{if(!e[o]&&0!==e[o])return i&&r.convert&&r.convert[i]?r.convert[i].call(r,""):"";l="function"==typeof e[o]?e[o].apply(r):e[o]}return i&&r.convert&&r.convert[i]?r.convert[i].call(r,l):l})}},{key:"resolveAbsBlock",value:function(t){var e=this;return t=t.replace(/{(.*?)}/g,function(t,n){var r=e.getDataByString(n);return void 0!==r?"function"==typeof r?r.apply(e):r:t})}},{key:"resolveInclude",value:function(t){var e=/<!-- #include id="(.*?)" -->/g;return t=t.replace(e,function(t,e){return(0,s.selector)("#"+e).innerHTML})}},{key:"resolveWith",value:function(t){var e=/<!-- BEGIN ([\w\-\.ぁ-んァ-ヶ亜-熙]+):with -->(([\n\r\t]|.)*?)<!-- END ([\w\-\.ぁ-んァ-ヶ亜-熙]+):with -->/g;return t=t.replace(e,function(t,e){return t=t.replace(/data\-bind=['"](.*?)['"]/g,"data-bind='"+e+".$1'")})}},{key:"resolveLoop",value:function(t){var e=/<!-- BEGIN ([\w\-\.ぁ-んァ-ヶ亜-熙]+?):loop -->(([\n\r\t]|.)*?)<!-- END ([\w\-\.ぁ-んァ-ヶ亜-熙]+?):loop -->/g,n=this;return t=t.replace(e,function(t,e,r){var o=n.getDataByString(e),a=[];a="function"==typeof o?o.apply(n):o;var i="";if(a instanceof Array)for(var l=0,s=a.length;l<s;l+=1)i+=n.resolveBlock(r,a[l],l);return i=i.replace(/\\([^\\])/g,"$1")})}},{key:"removeData",value:function(t){var e=this.data;return Object.keys(e).forEach(function(n){for(var r=0,o=t.length;r<o;r+=1)n===t[r]&&delete e[n]}),this}},{key:"hasLoop",value:function(t){var e=/<!-- BEGIN ([\w\-\.ぁ-んァ-ヶ亜-熙]+?):loop -->(([\n\r\t]|.)*?)<!-- END ([\w\-\.ぁ-んァ-ヶ亜-熙]+?):loop -->/g;return!!t.match(e)}},{key:"getHtml",value:function(t,e){var n=this.atemplate.find(function(e){return e.id===t}),r="";if(n&&n.html&&(r=n.html),e&&(r=t),!r)return"";var o=this.data;for(r=this.resolveInclude(r),r=this.resolveWith(r);this.hasLoop(r);)r=this.resolveLoop(r);return r=this.resolveBlock(r,o),r=r.replace(/\\([^\\])/g,"$1"),r=this.resolveAbsBlock(r),r.replace(/^([\t ])*\n/gm,"")}},{key:"update",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"html",n=arguments[1],r=this.templates;this.beforeUpdated&&this.beforeUpdated();for(var o=0,a=r.length;o<a;o+=1)!function(o,a){var i=r[o],c="#"+i,u=t.getHtml(i),f=(0,s.selector)("[data-id='"+i+"']");if(f)if("text"===e)f.innerText=u;else if(n){var h=document.createElement("div");h.innerHTML=u;var d=h.querySelector(n).outerHTML;(0,l.default)(f.querySelector(n),d)}else(0,l.default)(f,"<div data-id='"+i+"'>"+u+"</div>");else(0,s.selector)(c).insertAdjacentHTML("afterend",'<div data-id="'+i+'"></div>'),"text"===e?(0,s.selector)("[data-id='"+i+"']").innerText=u:(0,s.selector)("[data-id='"+i+"']").innerHTML=u;var p=t.atemplate.find(function(t){return t.id===i});p.binded||(p.binded=!0,t.addDataBind((0,s.selector)("[data-id='"+i+"']")),t.addActionBind((0,s.selector)("[data-id='"+i+"']")))}(o);return this.updateBindingData(n),this.onUpdated&&this.onUpdated(n),this}},{key:"updateBindingData",value:function(t){for(var e=this,n=this.templates,r=0,o=n.length;r<o;r+=1){var a=n[r],i=(0,s.selector)("[data-id='"+a+"']");t&&(i=i.querySelector(t));var l=i.querySelectorAll("[data-bind]");[].forEach.call(l,function(t){var n=e.getDataByString(t.getAttribute("data-bind"));"checkbox"===t.getAttribute("type")||"radio"===t.getAttribute("type")?n===t.value&&(t.checked=!0):t.value=n});var c=i.querySelectorAll("[data-bind-oneway]");[].forEach.call(c,function(t){var n=e.getDataByString(t.getAttribute("data-bind-oneway"));"checkbox"===t.getAttribute("type")||"radio"===t.getAttribute("type")?n===t.value&&(t.checked=!0):t.value=n})}return this}},{key:"applyMethod",value:function(t){for(var e,n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return(e=this.method)[t].apply(e,r)}},{key:"getComputedProp",value:function(t){return this.data[t].apply(this)}},{key:"remove",value:function(t){for(var e=this.data,n=t.split(".");n.length>1;)e=e[n.shift()];var r=n.shift();return r.match(/^\d+$/)?e.splice(Number(r),1):delete e[r],this}}]),t}();n.default=f,e.exports=n.default},{"./util":2,"ie-array-find-polyfill":8,morphdom:11}],2:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=n.matches=function(t,e){for(var n=(t.document||t.ownerDocument).querySelectorAll(e),r=n.length;--r>=0&&n.item(r)!==t;);return r>-1},o=(n.selector=function(t){return document.querySelector(t)},n.findAncestor=function(t,e){if("function"==typeof t.closest)return t.closest(e)||null;for(;t&&t!==document;){if(r(t,e))return t;t=t.parentElement}return null});n.on=function(t,e,n,r){n.split(" ").forEach(function(n){t.addEventListener(n,function(t){var n=(t.target,o(t.target,e));n&&(t.delegateTarget=n,r(t))})})}},{}],3:[function(t,e,n){"use strict";function r(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function o(t){var e=r(t),n=e[0],o=e[1];return 3*(n+o)/4-o}function a(t,e,n){return 3*(e+n)/4-n}function i(t){for(var e,n=r(t),o=n[0],i=n[1],l=new h(a(t,o,i)),s=0,c=i>0?o-4:o,u=0;u<c;u+=4)e=f[t.charCodeAt(u)]<<18|f[t.charCodeAt(u+1)]<<12|f[t.charCodeAt(u+2)]<<6|f[t.charCodeAt(u+3)],l[s++]=e>>16&255,l[s++]=e>>8&255,l[s++]=255&e;return 2===i&&(e=f[t.charCodeAt(u)]<<2|f[t.charCodeAt(u+1)]>>4,l[s++]=255&e),1===i&&(e=f[t.charCodeAt(u)]<<10|f[t.charCodeAt(u+1)]<<4|f[t.charCodeAt(u+2)]>>2,l[s++]=e>>8&255,l[s++]=255&e),l}function l(t){return u[t>>18&63]+u[t>>12&63]+u[t>>6&63]+u[63&t]}function s(t,e,n){for(var r,o=[],a=e;a<n;a+=3)r=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),o.push(l(r));return o.join("")}function c(t){for(var e,n=t.length,r=n%3,o=[],a=0,i=n-r;a<i;a+=16383)o.push(s(t,a,a+16383>i?i:a+16383));return 1===r?(e=t[n-1],o.push(u[e>>2]+u[e<<4&63]+"==")):2===r&&(e=(t[n-2]<<8)+t[n-1],o.push(u[e>>10]+u[e>>4&63]+u[e<<2&63]+"=")),o.join("")}n.byteLength=o,n.toByteArray=i,n.fromByteArray=c;for(var u=[],f=[],h="undefined"!=typeof Uint8Array?Uint8Array:Array,d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",p=0,g=d.length;p<g;++p)u[p]=d[p],f[d.charCodeAt(p)]=p;f["-".charCodeAt(0)]=62,f["_".charCodeAt(0)]=63},{}],4:[function(t,e,n){(function(e){/*!
   * The buffer module from node.js, for the browser.
   *
   * @author   Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
   * @license  MIT
   */
  "use strict";function r(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function o(t,e){if(r()<e)throw new RangeError("Invalid typed array length");return a.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e),t.__proto__=a.prototype):(null===t&&(t=new a(e)),t.length=e),t}function a(t,e,n){if(!(a.TYPED_ARRAY_SUPPORT||this instanceof a))return new a(t,e,n);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return c(this,t)}return i(this,t,e,n)}function i(t,e,n,r){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?h(t,e,n,r):"string"==typeof e?u(t,e,n):d(t,e)}function l(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function s(t,e,n,r){return l(e),e<=0?o(t,e):void 0!==n?"string"==typeof r?o(t,e).fill(n,r):o(t,e).fill(n):o(t,e)}function c(t,e){if(l(e),t=o(t,e<0?0:0|p(e)),!a.TYPED_ARRAY_SUPPORT)for(var n=0;n<e;++n)t[n]=0;return t}function u(t,e,n){if("string"==typeof n&&""!==n||(n="utf8"),!a.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|v(e,n);t=o(t,r);var i=t.write(e,n);return i!==r&&(t=t.slice(0,i)),t}function f(t,e){var n=e.length<0?0:0|p(e.length);t=o(t,n);for(var r=0;r<n;r+=1)t[r]=255&e[r];return t}function h(t,e,n,r){if(e.byteLength,n<0||e.byteLength<n)throw new RangeError("'offset' is out of bounds");if(e.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");return e=void 0===n&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,n):new Uint8Array(e,n,r),a.TYPED_ARRAY_SUPPORT?(t=e,t.__proto__=a.prototype):t=f(t,e),t}function d(t,e){if(a.isBuffer(e)){var n=0|p(e.length);return t=o(t,n),0===t.length?t:(e.copy(t,0,0,n),t)}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||J(e.length)?o(t,0):f(t,e);if("Buffer"===e.type&&W(e.data))return f(t,e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function p(t){if(t>=r())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r().toString(16)+" bytes");return 0|t}function g(t){return+t!=t&&(t=0),a.alloc(+t)}function v(t,e){if(a.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return F(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return V(t).length;default:if(r)return F(t).length;e=(""+e).toLowerCase(),r=!0}}function y(t,e,n){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if(n>>>=0,e>>>=0,n<=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return S(this,e,n);case"utf8":case"utf-8":return T(this,e,n);case"ascii":return I(this,e,n);case"latin1":case"binary":return P(this,e,n);case"base64":return N(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return D(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function w(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function b(t,e,n,r,o){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=o?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(o)return-1;n=t.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof e&&(e=a.from(e,r)),a.isBuffer(e))return 0===e.length?-1:m(t,e,n,r,o);if("number"==typeof e)return e&=255,a.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):m(t,[e],n,r,o);throw new TypeError("val must be string, number or Buffer")}function m(t,e,n,r,o){function a(t,e){return 1===i?t[e]:t.readUInt16BE(e*i)}var i=1,l=t.length,s=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;i=2,l/=2,s/=2,n/=2}var c;if(o){var u=-1;for(c=n;c<l;c++)if(a(t,c)===a(e,-1===u?0:c-u)){if(-1===u&&(u=c),c-u+1===s)return u*i}else-1!==u&&(c-=c-u),u=-1}else for(n+s>l&&(n=l-s),c=n;c>=0;c--){for(var f=!0,h=0;h<s;h++)if(a(t,c+h)!==a(e,h)){f=!1;break}if(f)return c}return-1}function x(t,e,n,r){n=Number(n)||0;var o=t.length-n;r?(r=Number(r))>o&&(r=o):r=o;var a=e.length;if(a%2!=0)throw new TypeError("Invalid hex string");r>a/2&&(r=a/2);for(var i=0;i<r;++i){var l=parseInt(e.substr(2*i,2),16);if(isNaN(l))return i;t[n+i]=l}return i}function E(t,e,n,r){return Q(F(e,t.length-n),t,n,r)}function C(t,e,n,r){return Q($(e),t,n,r)}function A(t,e,n,r){return C(t,e,n,r)}function k(t,e,n,r){return Q(V(e),t,n,r)}function B(t,e,n,r){return Q(z(e,t.length-n),t,n,r)}function N(t,e,n){return 0===e&&n===t.length?X.fromByteArray(t):X.fromByteArray(t.slice(e,n))}function T(t,e,n){n=Math.min(t.length,n);for(var r=[],o=e;o<n;){var a=t[o],i=null,l=a>239?4:a>223?3:a>191?2:1;if(o+l<=n){var s,c,u,f;switch(l){case 1:a<128&&(i=a);break;case 2:s=t[o+1],128==(192&s)&&(f=(31&a)<<6|63&s)>127&&(i=f);break;case 3:s=t[o+1],c=t[o+2],128==(192&s)&&128==(192&c)&&(f=(15&a)<<12|(63&s)<<6|63&c)>2047&&(f<55296||f>57343)&&(i=f);break;case 4:s=t[o+1],c=t[o+2],u=t[o+3],128==(192&s)&&128==(192&c)&&128==(192&u)&&(f=(15&a)<<18|(63&s)<<12|(63&c)<<6|63&u)>65535&&f<1114112&&(i=f)}}null===i?(i=65533,l=1):i>65535&&(i-=65536,r.push(i>>>10&1023|55296),i=56320|1023&i),r.push(i),o+=l}return R(r)}function R(t){var e=t.length;if(e<=Z)return String.fromCharCode.apply(String,t);for(var n="",r=0;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=Z));return n}function I(t,e,n){var r="";n=Math.min(t.length,n);for(var o=e;o<n;++o)r+=String.fromCharCode(127&t[o]);return r}function P(t,e,n){var r="";n=Math.min(t.length,n);for(var o=e;o<n;++o)r+=String.fromCharCode(t[o]);return r}function S(t,e,n){var r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);for(var o="",a=e;a<n;++a)o+=q(t[a]);return o}function D(t,e,n){for(var r=t.slice(e,n),o="",a=0;a<r.length;a+=2)o+=String.fromCharCode(r[a]+256*r[a+1]);return o}function _(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function O(t,e,n,r,o,i){if(!a.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||e<i)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function M(t,e,n,r){e<0&&(e=65535+e+1);for(var o=0,a=Math.min(t.length-n,2);o<a;++o)t[n+o]=(e&255<<8*(r?o:1-o))>>>8*(r?o:1-o)}function L(t,e,n,r){e<0&&(e=4294967295+e+1);for(var o=0,a=Math.min(t.length-n,4);o<a;++o)t[n+o]=e>>>8*(r?o:3-o)&255}function U(t,e,n,r,o,a){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function j(t,e,n,r,o){return o||U(t,e,n,4,3.4028234663852886e38,-3.4028234663852886e38),K.write(t,e,n,r,23,4),n+4}function G(t,e,n,r,o){return o||U(t,e,n,8,1.7976931348623157e308,-1.7976931348623157e308),K.write(t,e,n,r,52,8),n+8}function Y(t){if(t=H(t).replace(tt,""),t.length<2)return"";for(;t.length%4!=0;)t+="=";return t}function H(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function q(t){return t<16?"0"+t.toString(16):t.toString(16)}function F(t,e){e=e||1/0;for(var n,r=t.length,o=null,a=[],i=0;i<r;++i){if((n=t.charCodeAt(i))>55295&&n<57344){if(!o){if(n>56319){(e-=3)>-1&&a.push(239,191,189);continue}if(i+1===r){(e-=3)>-1&&a.push(239,191,189);continue}o=n;continue}if(n<56320){(e-=3)>-1&&a.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(e-=3)>-1&&a.push(239,191,189);if(o=null,n<128){if((e-=1)<0)break;a.push(n)}else if(n<2048){if((e-=2)<0)break;a.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;a.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return a}function $(t){for(var e=[],n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}function z(t,e){for(var n,r,o,a=[],i=0;i<t.length&&!((e-=2)<0);++i)n=t.charCodeAt(i),r=n>>8,o=n%256,a.push(o),a.push(r);return a}function V(t){return X.toByteArray(Y(t))}function Q(t,e,n,r){for(var o=0;o<r&&!(o+n>=e.length||o>=t.length);++o)e[o+n]=t[o];return o}function J(t){return t!==t}var X=t("base64-js"),K=t("ieee754"),W=t("isarray");n.Buffer=a,n.SlowBuffer=g,n.INSPECT_MAX_BYTES=50,a.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),n.kMaxLength=r(),a.poolSize=8192,a._augment=function(t){return t.__proto__=a.prototype,t},a.from=function(t,e,n){return i(null,t,e,n)},a.TYPED_ARRAY_SUPPORT&&(a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&a[Symbol.species]===a&&Object.defineProperty(a,Symbol.species,{value:null,configurable:!0})),a.alloc=function(t,e,n){return s(null,t,e,n)},a.allocUnsafe=function(t){return c(null,t)},a.allocUnsafeSlow=function(t){return c(null,t)},a.isBuffer=function(t){return!(null==t||!t._isBuffer)},a.compare=function(t,e){if(!a.isBuffer(t)||!a.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var n=t.length,r=e.length,o=0,i=Math.min(n,r);o<i;++o)if(t[o]!==e[o]){n=t[o],r=e[o];break}return n<r?-1:r<n?1:0},a.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(t,e){if(!W(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return a.alloc(0);var n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var r=a.allocUnsafe(e),o=0;for(n=0;n<t.length;++n){var i=t[n];if(!a.isBuffer(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(r,o),o+=i.length}return r},a.byteLength=v,a.prototype._isBuffer=!0,a.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)w(this,e,e+1);return this},a.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)w(this,e,e+3),w(this,e+1,e+2);return this},a.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)w(this,e,e+7),w(this,e+1,e+6),w(this,e+2,e+5),w(this,e+3,e+4);return this},a.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?T(this,0,t):y.apply(this,arguments)},a.prototype.equals=function(t){if(!a.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===a.compare(this,t)},a.prototype.inspect=function(){var t="",e=n.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),"<Buffer "+t+">"},a.prototype.compare=function(t,e,n,r,o){if(!a.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),e<0||n>t.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&e>=n)return 0;if(r>=o)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,r>>>=0,o>>>=0,this===t)return 0;for(var i=o-r,l=n-e,s=Math.min(i,l),c=this.slice(r,o),u=t.slice(e,n),f=0;f<s;++f)if(c[f]!==u[f]){i=c[f],l=u[f];break}return i<l?-1:l<i?1:0},a.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},a.prototype.indexOf=function(t,e,n){return b(this,t,e,n,!0)},a.prototype.lastIndexOf=function(t,e,n){return b(this,t,e,n,!1)},a.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var o=this.length-e;if((void 0===n||n>o)&&(n=o),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var a=!1;;)switch(r){case"hex":return x(this,t,e,n);case"utf8":case"utf-8":return E(this,t,e,n);case"ascii":return C(this,t,e,n);case"latin1":case"binary":return A(this,t,e,n);case"base64":return k(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,t,e,n);default:if(a)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),a=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Z=4096;a.prototype.slice=function(t,e){var n=this.length;t=~~t,e=void 0===e?n:~~e,t<0?(t+=n)<0&&(t=0):t>n&&(t=n),e<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t);var r;if(a.TYPED_ARRAY_SUPPORT)r=this.subarray(t,e),r.__proto__=a.prototype;else{var o=e-t;r=new a(o,void 0);for(var i=0;i<o;++i)r[i]=this[i+t]}return r},a.prototype.readUIntLE=function(t,e,n){t|=0,e|=0,n||_(t,e,this.length);for(var r=this[t],o=1,a=0;++a<e&&(o*=256);)r+=this[t+a]*o;return r},a.prototype.readUIntBE=function(t,e,n){t|=0,e|=0,n||_(t,e,this.length);for(var r=this[t+--e],o=1;e>0&&(o*=256);)r+=this[t+--e]*o;return r},a.prototype.readUInt8=function(t,e){return e||_(t,1,this.length),this[t]},a.prototype.readUInt16LE=function(t,e){return e||_(t,2,this.length),this[t]|this[t+1]<<8},a.prototype.readUInt16BE=function(t,e){return e||_(t,2,this.length),this[t]<<8|this[t+1]},a.prototype.readUInt32LE=function(t,e){return e||_(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},a.prototype.readUInt32BE=function(t,e){return e||_(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},a.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||_(t,e,this.length);for(var r=this[t],o=1,a=0;++a<e&&(o*=256);)r+=this[t+a]*o;return o*=128,r>=o&&(r-=Math.pow(2,8*e)),r},a.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||_(t,e,this.length);for(var r=e,o=1,a=this[t+--r];r>0&&(o*=256);)a+=this[t+--r]*o;return o*=128,a>=o&&(a-=Math.pow(2,8*e)),a},a.prototype.readInt8=function(t,e){return e||_(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},a.prototype.readInt16LE=function(t,e){e||_(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},a.prototype.readInt16BE=function(t,e){e||_(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},a.prototype.readInt32LE=function(t,e){return e||_(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},a.prototype.readInt32BE=function(t,e){return e||_(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},a.prototype.readFloatLE=function(t,e){return e||_(t,4,this.length),K.read(this,t,!0,23,4)},a.prototype.readFloatBE=function(t,e){return e||_(t,4,this.length),K.read(this,t,!1,23,4)},a.prototype.readDoubleLE=function(t,e){return e||_(t,8,this.length),K.read(this,t,!0,52,8)},a.prototype.readDoubleBE=function(t,e){return e||_(t,8,this.length),K.read(this,t,!1,52,8)},a.prototype.writeUIntLE=function(t,e,n,r){if(t=+t,e|=0,n|=0,!r){O(this,t,e,n,Math.pow(2,8*n)-1,0)}var o=1,a=0;for(this[e]=255&t;++a<n&&(o*=256);)this[e+a]=t/o&255;return e+n},a.prototype.writeUIntBE=function(t,e,n,r){if(t=+t,e|=0,n|=0,!r){O(this,t,e,n,Math.pow(2,8*n)-1,0)}var o=n-1,a=1;for(this[e+o]=255&t;--o>=0&&(a*=256);)this[e+o]=t/a&255;return e+n},a.prototype.writeUInt8=function(t,e,n){return t=+t,e|=0,n||O(this,t,e,1,255,0),a.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},a.prototype.writeUInt16LE=function(t,e,n){return t=+t,e|=0,n||O(this,t,e,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):M(this,t,e,!0),e+2},a.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||O(this,t,e,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):M(this,t,e,!1),e+2},a.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||O(this,t,e,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):L(this,t,e,!0),e+4},a.prototype.writeUInt32BE=function(t,e,n){return t=+t,e|=0,n||O(this,t,e,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):L(this,t,e,!1),e+4},a.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e|=0,!r){var o=Math.pow(2,8*n-1);O(this,t,e,n,o-1,-o)}var a=0,i=1,l=0;for(this[e]=255&t;++a<n&&(i*=256);)t<0&&0===l&&0!==this[e+a-1]&&(l=1),this[e+a]=(t/i>>0)-l&255;return e+n},a.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e|=0,!r){var o=Math.pow(2,8*n-1);O(this,t,e,n,o-1,-o)}var a=n-1,i=1,l=0;for(this[e+a]=255&t;--a>=0&&(i*=256);)t<0&&0===l&&0!==this[e+a+1]&&(l=1),this[e+a]=(t/i>>0)-l&255;return e+n},a.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||O(this,t,e,1,127,-128),a.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},a.prototype.writeInt16LE=function(t,e,n){return t=+t,e|=0,n||O(this,t,e,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):M(this,t,e,!0),e+2},a.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||O(this,t,e,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):M(this,t,e,!1),e+2},a.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||O(this,t,e,4,2147483647,-2147483648),a.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):L(this,t,e,!0),e+4},a.prototype.writeInt32BE=function(t,e,n){return t=+t,e|=0,n||O(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),a.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):L(this,t,e,!1),e+4},a.prototype.writeFloatLE=function(t,e,n){return j(this,t,e,!0,n)},a.prototype.writeFloatBE=function(t,e,n){return j(this,t,e,!1,n)},a.prototype.writeDoubleLE=function(t,e,n){return G(this,t,e,!0,n)},a.prototype.writeDoubleBE=function(t,e,n){return G(this,t,e,!1,n)},a.prototype.copy=function(t,e,n,r){if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);var o,i=r-n;if(this===t&&n<e&&e<r)for(o=i-1;o>=0;--o)t[o+e]=this[o+n];else if(i<1e3||!a.TYPED_ARRAY_SUPPORT)for(o=0;o<i;++o)t[o+e]=this[o+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+i),e);return i},a.prototype.fill=function(t,e,n,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===t.length){var o=t.charCodeAt(0);o<256&&(t=o)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!a.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0);var i;if("number"==typeof t)for(i=e;i<n;++i)this[i]=t;else{var l=a.isBuffer(t)?t:F(new a(t,r).toString()),s=l.length;for(i=0;i<n-e;++i)this[i+e]=l[i%s]}return this};var tt=/[^+\/0-9A-Za-z-_]/g}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"base64-js":3,ieee754:9,isarray:10}],5:[function(t,e,n){(function(t){var n=function(){"use strict";function e(t,e){return null!=e&&t instanceof e}function n(r,o,a,i,f){function h(r,a){if(null===r)return null;if(0===a)return r;var v,y;if("object"!=typeof r)return r;if(e(r,s))v=new s;else if(e(r,c))v=new c;else if(e(r,u))v=new u(function(t,e){r.then(function(e){t(h(e,a-1))},function(t){e(h(t,a-1))})});else if(n.__isArray(r))v=[];else if(n.__isRegExp(r))v=new RegExp(r.source,l(r)),r.lastIndex&&(v.lastIndex=r.lastIndex);else if(n.__isDate(r))v=new Date(r.getTime());else{if(g&&t.isBuffer(r))return v=t.allocUnsafe?t.allocUnsafe(r.length):new t(r.length),r.copy(v),v;e(r,Error)?v=Object.create(r):void 0===i?(y=Object.getPrototypeOf(r),v=Object.create(y)):(v=Object.create(i),y=i)}if(o){var w=d.indexOf(r);if(-1!=w)return p[w];d.push(r),p.push(v)}e(r,s)&&r.forEach(function(t,e){var n=h(e,a-1),r=h(t,a-1);v.set(n,r)}),e(r,c)&&r.forEach(function(t){var e=h(t,a-1);v.add(e)});for(var b in r){var m;y&&(m=Object.getOwnPropertyDescriptor(y,b)),m&&null==m.set||(v[b]=h(r[b],a-1))}if(Object.getOwnPropertySymbols)for(var x=Object.getOwnPropertySymbols(r),b=0;b<x.length;b++){var E=x[b],C=Object.getOwnPropertyDescriptor(r,E);(!C||C.enumerable||f)&&(v[E]=h(r[E],a-1),C.enumerable||Object.defineProperty(v,E,{enumerable:!1}))}if(f)for(var A=Object.getOwnPropertyNames(r),b=0;b<A.length;b++){var k=A[b],C=Object.getOwnPropertyDescriptor(r,k);C&&C.enumerable||(v[k]=h(r[k],a-1),Object.defineProperty(v,k,{enumerable:!1}))}return v}"object"==typeof o&&(a=o.depth,i=o.prototype,f=o.includeNonEnumerable,o=o.circular);var d=[],p=[],g=void 0!==t;return void 0===o&&(o=!0),void 0===a&&(a=1/0),h(r,a)}function r(t){return Object.prototype.toString.call(t)}function o(t){return"object"==typeof t&&"[object Date]"===r(t)}function a(t){return"object"==typeof t&&"[object Array]"===r(t)}function i(t){return"object"==typeof t&&"[object RegExp]"===r(t)}function l(t){var e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),e}var s;try{s=Map}catch(t){s=function(){}}var c;try{c=Set}catch(t){c=function(){}}var u;try{u=Promise}catch(t){u=function(){}}return n.clonePrototype=function(t){if(null===t)return null;var e=function(){};return e.prototype=t,new e},n.__objToStr=r,n.__isDate=o,n.__isArray=a,n.__isRegExp=i,n.__getRegExpFlags=l,n}();"object"==typeof e&&e.exports&&(e.exports=n)}).call(this,t("buffer").Buffer)},{buffer:4}],6:[function(t,e,n){try{var r=new window.CustomEvent("test");if(r.preventDefault(),!0!==r.defaultPrevented)throw new Error("Could not prevent default")}catch(t){var o=function(t,e){var n,r;return e=e||{bubbles:!1,cancelable:!1,detail:void 0},n=document.createEvent("CustomEvent"),n.initCustomEvent(t,e.bubbles,e.cancelable,e.detail),r=n.preventDefault,n.preventDefault=function(){r.call(this);try{Object.defineProperty(this,"defaultPrevented",{get:function(){return!0}})}catch(t){this.defaultPrevented=!0}},n};o.prototype=window.Event.prototype,window.CustomEvent=o}},{}],7:[function(t,e,n){(function(t){/*!
   * @description Recursive object extending
   * @author Viacheslav Lotsmanov <lotsmanov89@gmail.com>
   * @license MIT
   *
   * The MIT License (MIT)
   *
   * Copyright (c) 2013-2018 Viacheslav Lotsmanov
   *
   * Permission is hereby granted, free of charge, to any person obtaining a copy of
   * this software and associated documentation files (the "Software"), to deal in
   * the Software without restriction, including without limitation the rights to
   * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
   * the Software, and to permit persons to whom the Software is furnished to do so,
   * subject to the following conditions:
   *
   * The above copyright notice and this permission notice shall be included in all
   * copies or substantial portions of the Software.
   *
   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
   * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
   * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
   * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
   * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
   */
  "use strict";function n(e){return e instanceof t||e instanceof Date||e instanceof RegExp}function r(e){if(e instanceof t){var n=t.alloc?t.alloc(e.length):new t(e.length);return e.copy(n),n}if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp)return new RegExp(e);throw new Error("Unexpected situation")}function o(t){var e=[];return t.forEach(function(t,a){"object"==typeof t&&null!==t?Array.isArray(t)?e[a]=o(t):n(t)?e[a]=r(t):e[a]=i({},t):e[a]=t}),e}function a(t,e){return"__proto__"===e?void 0:t[e]}var i=e.exports=function(){if(arguments.length<1||"object"!=typeof arguments[0])return!1;if(arguments.length<2)return arguments[0];var t,e,l=arguments[0],s=Array.prototype.slice.call(arguments,1);return s.forEach(function(s){"object"!=typeof s||null===s||Array.isArray(s)||Object.keys(s).forEach(function(c){return e=a(l,c),t=a(s,c),t===l?void 0:"object"!=typeof t||null===t?void(l[c]=t):Array.isArray(t)?void(l[c]=o(t)):n(t)?void(l[c]=r(t)):"object"!=typeof e||null===e||Array.isArray(e)?void(l[c]=i({},t)):void(l[c]=i(e,t))})}),l}}).call(this,t("buffer").Buffer)},{buffer:4}],8:[function(t,e,n){"use strict";Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(t){if(null==this)throw new TypeError("this is null or not defined");var e=Object(this),n=e.length>>>0;if("function"!=typeof t)throw new TypeError("predicate must be a function");for(var r=arguments[1],o=0;o<n;){var a=e[o];if(t.call(r,a,o,e))return a;o++}}})},{}],9:[function(t,e,n){n.read=function(t,e,n,r,o){var a,i,l=8*o-r-1,s=(1<<l)-1,c=s>>1,u=-7,f=n?o-1:0,h=n?-1:1,d=t[e+f];for(f+=h,a=d&(1<<-u)-1,d>>=-u,u+=l;u>0;a=256*a+t[e+f],f+=h,u-=8);for(i=a&(1<<-u)-1,a>>=-u,u+=r;u>0;i=256*i+t[e+f],f+=h,u-=8);if(0===a)a=1-c;else{if(a===s)return i?NaN:1/0*(d?-1:1);i+=Math.pow(2,r),a-=c}return(d?-1:1)*i*Math.pow(2,a-r)},n.write=function(t,e,n,r,o,a){var i,l,s,c=8*a-o-1,u=(1<<c)-1,f=u>>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:a-1,p=r?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(l=isNaN(e)?1:0,i=u):(i=Math.floor(Math.log(e)/Math.LN2),e*(s=Math.pow(2,-i))<1&&(i--,s*=2),e+=i+f>=1?h/s:h*Math.pow(2,1-f),e*s>=2&&(i++,s/=2),i+f>=u?(l=0,i=u):i+f>=1?(l=(e*s-1)*Math.pow(2,o),i+=f):(l=e*Math.pow(2,f-1)*Math.pow(2,o),i=0));o>=8;t[n+d]=255&l,d+=p,l/=256,o-=8);for(i=i<<o|l,c+=o;c>0;t[n+d]=255&i,d+=p,i/=256,c-=8);t[n+d-p]|=128*g}},{}],10:[function(t,e,n){var r={}.toString;e.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},{}],11:[function(t,e,n){"use strict";function r(t){!f&&p.createRange&&(f=p.createRange(),f.selectNode(p.body));var e;return f&&f.createContextualFragment?e=f.createContextualFragment(t):(e=p.createElement("body"),e.innerHTML=t),e.childNodes[0]}function o(t,e){var n=t.nodeName,r=e.nodeName;return n===r||!!(e.actualize&&n.charCodeAt(0)<91&&r.charCodeAt(0)>90)&&n===r.toUpperCase()}function a(t,e){return e&&e!==d?p.createElementNS(e,t):p.createElement(t)}function i(t,e){for(var n=t.firstChild;n;){var r=n.nextSibling;e.appendChild(n),n=r}return e}function l(t,e){var n,r,o,a,i,l=e.attributes;for(n=l.length-1;n>=0;--n)r=l[n],o=r.name,a=r.namespaceURI,i=r.value,a?(o=r.localName||o,t.getAttributeNS(a,o)!==i&&t.setAttributeNS(a,o,i)):t.getAttribute(o)!==i&&t.setAttribute(o,i);for(l=t.attributes,n=l.length-1;n>=0;--n)r=l[n],!1!==r.specified&&(o=r.name,a=r.namespaceURI,a?(o=r.localName||o,v(e,a,o)||t.removeAttributeNS(a,o)):v(e,null,o)||t.removeAttribute(o))}function s(t,e,n){t[n]!==e[n]&&(t[n]=e[n],t[n]?t.setAttribute(n,""):t.removeAttribute(n,""))}function c(){}function u(t){return t.id}var f,h,d="http://www.w3.org/1999/xhtml",p="undefined"==typeof document?void 0:document,g=p?p.body||p.createElement("div"):{};h=g.hasAttributeNS?function(t,e,n){return t.hasAttributeNS(e,n)}:g.hasAttribute?function(t,e,n){return t.hasAttribute(n)}:function(t,e,n){return null!=t.getAttributeNode(e,n)};var v=h,y={OPTION:function(t,e){s(t,e,"selected")},INPUT:function(t,e){s(t,e,"checked"),s(t,e,"disabled"),t.value!==e.value&&(t.value=e.value),v(e,null,"value")||t.removeAttribute("value")},TEXTAREA:function(t,e){var n=e.value;t.value!==n&&(t.value=n);var r=t.firstChild;if(r){var o=r.nodeValue;if(o==n||!n&&o==t.placeholder)return;r.nodeValue=n}},SELECT:function(t,e){if(!v(e,null,"multiple")){for(var n=0,r=e.firstChild;r;){var o=r.nodeName;if(o&&"OPTION"===o.toUpperCase()){if(v(r,null,"selected")){n;break}n++}r=r.nextSibling}t.selectedIndex=n}}},w=1,b=3,m=8,x=function(t){return function(e,n,l){function s(t){E?E.push(t):E=[t]}function f(t,e){if(t.nodeType===w)for(var n=t.firstChild;n;){var r=void 0;e&&(r=C(n))?s(r):(R(n),n.firstChild&&f(n,e)),n=n.nextSibling}}function h(t,e,n){!1!==T(t)&&(e&&e.removeChild(t),R(t),f(t,n))}function d(t){if(t.nodeType===w)for(var e=t.firstChild;e;){var n=C(e);n&&(S[n]=e),d(e),e=e.nextSibling}}function g(t){k(t);for(var e=t.firstChild;e;){var n=e.nextSibling,r=C(e);if(r){var a=S[r];a&&o(e,a)&&(e.parentNode.replaceChild(a,e),v(a,e))}g(e),e=n}}function v(r,a,i){var l,c=C(a);if(c&&delete S[c],!n.isSameNode||!n.isSameNode(e)){if(!i){if(!1===B(r,a))return;if(t(r,a),N(r),!1===I(r,a))return}if("TEXTAREA"!==r.nodeName){var u,f,d,x,E=a.firstChild,k=r.firstChild;t:for(;E;){for(d=E.nextSibling,u=C(E);k;){if(f=k.nextSibling,E.isSameNode&&E.isSameNode(k)){E=d,k=f;continue t}l=C(k);var T=k.nodeType,R=void 0;if(T===E.nodeType&&(T===w?(u?u!==l&&((x=S[u])?k.nextSibling===x?R=!1:(r.insertBefore(x,k),f=k.nextSibling,l?s(l):h(k,r,!0),k=x):R=!1):l&&(R=!1),(R=!1!==R&&o(k,E))&&v(k,E)):T!==b&&T!=m||(R=!0,k.nodeValue!==E.nodeValue&&(k.nodeValue=E.nodeValue))),R){E=d,k=f;continue t}l?s(l):h(k,r,!0),k=f}if(u&&(x=S[u])&&o(x,E))r.appendChild(x),v(x,E);else{var P=A(E);!1!==P&&(P&&(E=P),E.actualize&&(E=E.actualize(r.ownerDocument||p)),r.appendChild(E),g(E))}E=d,k=f}for(;k;)f=k.nextSibling,(l=C(k))?s(l):h(k,r,!0),k=f}var D=y[r.nodeName];D&&D(r,a)}}if(l||(l={}),"string"==typeof n)if("#document"===e.nodeName||"HTML"===e.nodeName){var x=n;n=p.createElement("html"),n.innerHTML=x}else n=r(n);var E,C=l.getNodeKey||u,A=l.onBeforeNodeAdded||c,k=l.onNodeAdded||c,B=l.onBeforeElUpdated||c,N=l.onElUpdated||c,T=l.onBeforeNodeDiscarded||c,R=l.onNodeDiscarded||c,I=l.onBeforeElChildrenUpdated||c,P=!0===l.childrenOnly,S={};d(e);var D=e,_=D.nodeType,O=n.nodeType;if(!P)if(_===w)O===w?o(e,n)||(R(e),D=i(e,a(n.nodeName,n.namespaceURI))):D=n;else if(_===b||_===m){if(O===_)return D.nodeValue!==n.nodeValue&&(D.nodeValue=n.nodeValue),D;D=n}if(D===n)R(e);else if(v(D,n,P),E)for(var M=0,L=E.length;M<L;M++){var U=S[E[M]];U&&h(U,U.parentNode,!1)}return!P&&D!==e&&e.parentNode&&(D.actualize&&(D=D.actualize(e.ownerDocument||p)),e.parentNode.replaceChild(D,e)),D}}(l);e.exports=x},{}],12:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(n,"__esModule",{value:!0});var l=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),s=t("a-template"),c=r(s),u=t("clone"),f=r(u),h=t("deep-extend"),d=r(h),p=t("./util.js"),g=r(p),v='\x3c!-- BEGIN showMenu:exist --\x3e\n<ul class="a-table-menu" style="top:{menuY}px;left:{menuX}px;">\n\t\x3c!-- BEGIN mode:touch#cell --\x3e\n\t<li data-action-click="mergeCells">\\{message.mergeCells\\}</li>\n\t<li data-action-click="splitCell">\\{message.splitCell\\}</li>\n\t<li data-action-click="changeCellTypeTo(th)">\\{message.changeToTh\\}</li>\n\t<li data-action-click="changeCellTypeTo(td)">\\{message.changeToTd\\}</li>\n\t<li data-action-click="align(left)">\\{message.alignLeft\\}</li>\n\t<li data-action-click="align(center)">\\{message.alignCenter\\}</li>\n\t<li data-action-click="align(right)">\\{message.alignRight\\}</li>\n\t\x3c!-- END mode:touch#cell --\x3e\n\t\x3c!-- BEGIN mode:touch#col --\x3e\n\t<li data-action-click="insertColLeft({selectedRowNo})">\\{message.addColumnLeft\\}</li>\n\t<li data-action-click="insertColRight({selectedRowNo})">\\{message.addColumnRight\\}</li>\n\t<li data-action-click="removeCol({selectedRowNo})">\\{message.removeColumn\\}</li>\n\t\x3c!-- END mode:touch#col --\x3e\n\t\x3c!-- BEGIN mode:touch#row --\x3e\n\t<li data-action-click="insertRowAbove({selectedColNo})">\\{message.addRowTop\\}</li>\n\t<li data-action-click="insertRowBelow({selectedColNo})">\\{message.addRowBottom\\}</li>\n\t<li data-action-click="removeRow({selectedColNo})">\\{message.removeRow\\}</li>\n\t\x3c!-- END mode:touch#row --\x3e\n</ul>\n\x3c!-- END showMenu:exist --\x3e\n<div class="a-table-wrapper">\n\t\x3c!-- BEGIN inputMode:touch#table --\x3e\n\t<table class="a-table">\n\t\t<tr class="a-table-header js-table-header">\n\t\t\t<th class="a-table-first"></th>\n\t\t\t\x3c!-- BEGIN highestRow:loop --\x3e\n\t\t\t\x3c!-- \\BEGIN selectedRowNo:touch#{i} --\x3e\n\t\t\t<th data-action-click="unselect()" class="selected"><span class="a-table-toggle-btn"></span></th>\n\t\t\t\x3c!-- \\END selectedRowNo:touch#{i} --\x3e\n\t\t\t\x3c!-- \\BEGIN selectedRowNo:touchnot#{i} --\x3e\n\t\t\t<th data-action-click="selectRow({i})"><span class="a-table-toggle-btn"></span></th>\n\t\t\t\x3c!-- \\END selectedRowNo:touchnot#{i} --\x3e\n\t\t\t\n\t\t\t\x3c!-- END highestRow:loop --\x3e\n\t\t</tr>\n\t\t\x3c!-- BEGIN row:loop --\x3e\n\t\t<tr>\n\t\t\t\x3c!-- \\BEGIN selectedColNo:touchnot#{i} --\x3e\n\t\t\t<th class="a-table-side js-table-side" data-action-click="selectCol({i})"><span class="a-table-toggle-btn"></span></th>\n\t\t\t\x3c!-- \\END selectedColNo:touchnot#{i} --\x3e\n\t\t\t\x3c!-- \\BEGIN selectedColNo:touch#{i} --\x3e\n\t\t\t<th class="a-table-side js-table-side selected" data-action-click="unselect()"><span class="a-table-toggle-btn"></span></th>\n\t\t\t\x3c!-- \\END selectedColNo:touch#{i} --\x3e\n\t\t\t\x3c!-- \\BEGIN row.{i}.col:loop --\x3e\n\t\t\t<td colspan="\\{colspan\\}" rowspan="\\{rowspan\\}" data-action="updateTable(\\{i\\},{i})" data-cell-id="\\{i\\}-{i}" class="\x3c!-- \\BEGIN selected:exist --\x3ea-table-selected\x3c!-- \\END selected:exist --\x3e\x3c!-- \\BEGIN type:touch#th --\x3e a-table-th\x3c!-- END \\type:touch#th --\x3e\x3c!-- \\BEGIN mark.top:exist --\x3e a-table-border-top\x3c!-- \\END mark.top:exist --\x3e\x3c!-- \\BEGIN mark.right:exist --\x3e a-table-border-right\x3c!-- \\END mark.right:exist --\x3e\x3c!-- \\BEGIN mark.bottom:exist --\x3e a-table-border-bottom\x3c!-- \\END mark.bottom:exist --\x3e\x3c!-- \\BEGIN mark.left:exist --\x3e a-table-border-left\x3c!-- \\END mark.left:exist --\x3e\x3c!-- \\BEGIN cellClass:exist --\x3e \\{cellClass\\}\x3c!-- \\END cellClass:exist --\x3e"><div class="a-table-editable \\{align\\}" contenteditable>\\{value\\}</div></td>\n\t\t\t\x3c!-- \\END row.{i}.col:loop --\x3e\n\t\t</tr>\n\t\t\x3c!-- END row:loop --\x3e\n\t</table>\n\t\x3c!-- END inputMode:touch#table --\x3e\n\t\x3c!-- BEGIN inputMode:touch#source --\x3e\n\t<textarea data-bind="tableResult" class="a-table-textarea" data-action-input="updateResult"></textarea>\n\t\x3c!-- END inputMode:touch#source --\x3e\n</div>\n',y='\x3c!-- BEGIN showBtnList:exist --\x3e\n<div class="a-table-btn-group-list">\n\t<div class="\\{mark.btn.group\\}">\n\t\t\x3c!-- BEGIN inputMode:touch#table --\x3e\n\t\t<button type="button" class="\\{mark.btn.item\\}" data-action-click="changeInputMode(source)"><i class="\\{mark.icon.source\\}"></i></button>\n\t\t\x3c!-- END inputMode:touch#table --\x3e\n\t\t\x3c!-- BEGIN inputMode:touch#source --\x3e\n\t\t<button type="button" class="\\{mark.btn.itemActive\\}" data-action-click="changeInputMode(table)"><i class="\\{mark.icon.source\\}"></i></button>\n\t\t\x3c!-- END inputMode:touch#source --\x3e\n\t</div>\n\t<div class="\\{mark.btn.group\\}">\n\t\t<button type="button" class="\\{mark.btn.item\\}" data-action-click="mergeCells"><i class="\\{mark.icon.merge\\}"></i></button><button type="button" class="\\{mark.btn.item\\}" data-action-click="splitCell()"><i class="\\{mark.icon.split\\}"></i></button><button type="button" class="\\{mark.btn.item\\}" data-action-click="undo()"><i class="\\{mark.icon.undo\\}"></i></button>\n\t</div>\n\t<div class="\\{mark.btn.group\\}">\n\t\t<button type="button" class="\\{mark.btn.item\\}" data-action-click="changeCellTypeTo(td)">\x3c!-- BEGIN mark.icon.td:empty --\x3etd\x3c!-- END mark.icon.td:empty --\x3e\x3c!-- BEGIN mark.icon.td:exist --\x3e<i class="\\{mark.icon.td\\}"></i>\x3c!-- END mark.icon.td:exist --\x3e</button><button type="button" class="\\{mark.btn.item\\}" data-action-click="changeCellTypeTo(th)">\x3c!-- BEGIN mark.icon.th:empty --\x3eth\x3c!-- END mark.icon.th:empty --\x3e\x3c!-- BEGIN mark.icon.th:exist --\x3e<i class="\\{mark.icon.th\\}"></i>\x3c!-- END mark.icon.th:exist --\x3e</button>\n\t</div>\n\t<div class="\\{mark.btn.group\\}">\n\t\t<button type="button" class="\\{mark.btn.item\\}" data-action-click="align(left)"><i class="\\{mark.icon.alignLeft\\}"></i></button><button type="button" class="\\{mark.btn.item\\}" data-action-click="align(center)"><i class="\\{mark.icon.alignCenter\\}"></i></button><button type="button" class="\\{mark.btn.item\\}" data-action-click="align(right)"><i class="\\{mark.icon.alignRight\\}"></i></button>\n\t</div>\n\t<div class="\\{mark.btn.group\\}">\n\t\t<div class="\\{mark.actionGroup\\}">\n\t\t\t<label class="\\{mark.label\\}">セル</label>\n\t\t\t<select class="\\{mark.selector.self\\}" data-bind="cellClass" data-action-change="changeCellClass()">\n\t\t\t\t<option value="">---</option>\n\t\t\t\t\x3c!-- BEGIN selector.option:loop --\x3e\n\t\t\t\t<option value="{value}">{label}</option>\n\t\t\t\t\x3c!-- END selector.option:loop --\x3e\n\t\t\t</select>\n\t\t</div>\n\t</div>\n\t\x3c!-- BEGIN tableOption:exist --\x3e\n\t<div class="\\{mark.btn.group\\}">\n\t\t<div class="\\{mark.actionGroup\\}">\n\t\t\t<label class="\\{mark.label\\}">テーブル</label>\n\t\t\t<select class="\\{mark.selector.self\\}" data-bind="tableClass" data-action-change="update">\n\t\t\t\t<option value="">---</option>\n\t\t\t\t\x3c!-- BEGIN tableOption:loop --\x3e\n\t\t\t\t<option value="{value}">{label}</option>\n\t\t\t\t\x3c!-- END tableOption:loop --\x3e\n\t\t\t</select>\n\t\t</div>\n\t</div>\n\t\x3c!-- END tableOption:exist --\x3e\n</div>\n\x3c!-- END showBtnList:exist --\x3e\n',w='<table class="{tableClass}">\n\t\x3c!-- BEGIN row:loop --\x3e\n\t<tr>\n\t\t\x3c!-- \\BEGIN row.{i}.col:loop --\x3e\n\t\t\x3c!-- \\BEGIN type:touch#th --\x3e\n\t\t<th\x3c!-- \\BEGIN colspan:touchnot#1 --\x3e colspan="\\{colspan\\}"\x3c!-- \\END colspan:touchnot#1 --\x3e\x3c!-- \\BEGIN rowspan:touchnot#1 --\x3e rowspan="\\{rowspan\\}"\x3c!-- \\END rowspan:touchnot#1 --\x3e class="\x3c!-- \\BEGIN align:exist --\x3e\\{align\\}[getStyleByAlign]\x3c!-- \\END align:exist --\x3e\x3c!-- \\BEGIN cellClass:exist --\x3e \\{cellClass\\}\x3c!-- \\END cellClass:exist --\x3e">\\{value\\}</th>\n\t\t\x3c!-- \\END type:touch#th --\x3e\n\t\t\x3c!-- \\BEGIN type:touch#td --\x3e\n\t\t<td\x3c!-- \\BEGIN colspan:touchnot#1 --\x3e colspan="\\{colspan\\}"\x3c!-- \\END colspan:touchnot#1 --\x3e\x3c!-- \\BEGIN rowspan:touchnot#1 --\x3e rowspan="\\{rowspan\\}"\x3c!-- \\END rowspan:touchnot#1 --\x3e class="\x3c!-- \\BEGIN align:exist --\x3e\\{align\\}[getStyleByAlign] \x3c!-- \\END align:exist --\x3e\x3c!-- \\BEGIN cellClass:exist --\x3e\\{cellClass\\}\x3c!-- \\END cellClass:exist --\x3e">\\{value\\}</td>\n\t\t\x3c!-- \\END type:touch#td --\x3e\n\t\t\x3c!-- \\END row.{i}.col:loop --\x3e\n\t</tr>\n\t\x3c!-- END row:loop --\x3e\n</table>\n',b={showBtnList:!0,lang:"en",mark:{align:{default:"left",left:"left",center:"center",right:"right"},btn:{group:"a-table-btn-list",item:"a-table-btn",itemActive:"a-table-btn-active"},icon:{alignLeft:"a-table-icon a-table-icon-left",alignCenter:"a-table-icon a-table-icon-center",alignRight:"a-table-icon a-table-icon-right",undo:"a-table-icon a-table-icon-undo",merge:"a-table-icon a-table-icon-merge02",split:"a-table-icon a-table-icon-split02",table:"a-table-icon a-table-icon-th02",source:"a-table-icon a-table-icon-source01",td:"a-table-icon a-table-icon-td03",th:"a-table-icon a-table-icon-th02"},label:"a-table-label",actionGroup:"a-table-action-group",selector:{self:"a-table-selector"}},message:{mergeCells:"merge cell",splitCell:"split cell",changeToTh:"change to th",changeToTd:"change to td",alignLeft:"align left",alignCenter:"align center",alignRight:"align right",addColumnLeft:"insert column on the left",addColumnRight:"insert column on the right",removeColumn:"remove column",addRowTop:"insert row above",addRowBottom:"insert row below",removeRow:"remove row",source:"Source",mergeCellError1:"All possible cells should be selected so to merge cells into one",mergeCellConfirm1:"The top left cell's value of the selected range will only be saved. Are you sure you want to continue?",pasteError1:"You can't paste here",splitError1:"Cell is not selected",splitError2:"Only one cell should be selected",splitError3:"You can't split the cell anymore"}},m=function(t){function e(t,n){o(this,e);var r=a(this,(e.__proto__||Object.getPrototypeOf(e)).call(this));r.id=e.getUniqId(),r.menu_id=e.getUniqId(),r.addTemplate(r.id,v),r.addTemplate(r.menu_id,g.default.removeIndentNewline(y)),r.data=(0,d.default)({},b,n);var i=r.data,l="string"==typeof t?document.querySelector(t):t;i.point={x:-1,y:-1},i.selectedRowNo=-1,i.selectedColNo=-1,i.showBtnList=!0,i.row=r.parse("<table>"+l.innerHTML+"</table>"),i.tableResult=r.getTable(),i.tableClass=l.getAttribute("class")||"",i.highestRow=r.highestRow,i.history=[],i.inputMode="table",i.cellClass="",i.history.push((0,f.default)(i.row)),r.convert={},r.convert.getStyleByAlign=r.getStyleByAlign,r.convert.setClass=r.setClass;var s="\n    <div class='a-table-container'>\n        <div data-id='"+r.menu_id+"'></div>\n        <div class='a-table-outer'>\n          <div class='a-table-inner'>\n            <div data-id='"+r.id+"'></div>\n          </div>\n        </div>\n    </div>";return g.default.before(l,s),g.default.removeElement(l),r.update(),r}return i(e,t),l(e,[{key:"highestRow",value:function(){var t=[],e=this.data.row[0],n=0;return e?(e.col.forEach(function(e){for(var r=parseInt(e.colspan),o=0;o<r;o++)t.push(n),n++}),t):t}},{key:"_getTableLength",value:function(t){return{x:this._getRowLength(t[0].col),y:this._getColLength(t)}}},{key:"_getRowLength",value:function(t){var e=0;return t.forEach(function(t){e+=parseInt(t.colspan)}),e}},{key:"_getColLength",value:function(t){var e=0,n=0;return t.forEach(function(t){0===n&&(n=parseInt(t.col[0].rowspan),e+=n),n--}),e}},{key:"_getElementByQuery",value:function(t){return document.querySelector("[data-id='"+this.id+"'] "+t)}},{key:"_getElementsByQuery",value:function(t){return document.querySelectorAll("[data-id='"+this.id+"'] "+t)}},{key:"_getSelf",value:function(){return document.querySelector("[data-id='"+this.id+"']")}},{key:"getCellByIndex",value:function(t,e){return this._getElementByQuery("[data-cell-id='"+t+"-"+e+"']")}},{key:"getCellInfoByIndex",value:function(t,e){var n=(this.id,this.getCellByIndex(t,e));if(!n)return!1;var r=g.default.offset(n),o=r.left,a=r.top,i=-1,l=-1,s=parseInt(n.getAttribute("colspan")),c=parseInt(n.getAttribute("rowspan")),u=this._getElementsByQuery(".js-table-header th"),f=this._getElementsByQuery(".js-table-side");return[].forEach.call(u,function(t,e){g.default.offset(t).left===o&&(i=e)}),[].forEach.call(f,function(t,e){g.default.offset(t).top===a&&(l=e)}),{x:i-1,y:l,width:s,height:c}}},{key:"getLargePoint",value:function(){for(var t=[],e=[],n=[],r=[],o=0,a=arguments.length;o<a;o++)t.push(arguments[o].x),e.push(arguments[o].y),n.push(arguments[o].x+arguments[o].width),r.push(arguments[o].y+arguments[o].height);var i=Math.min.apply(Math,t),l=Math.min.apply(Math,e);return{x:i,y:l,width:Math.max.apply(Math,n)-i,height:Math.max.apply(Math,r)-l}}},{key:"getSelectedPoints",value:function(){var t=[],e=this;return this.data.row.forEach(function(n,r){if(!n.col)return!1;n.col.forEach(function(n,o){if(n.selected){var a=e.getCellInfoByIndex(o,r);a&&t.push(a)}})}),t}},{key:"getSelectedPoint",value:function(){var t=this.getSelectedPoints();if(t&&t[0])return t[0]}},{key:"getAllPoints",value:function(){var t=[],e=this;return this.data.row.forEach(function(n,r){n&&n.col&&n.col.forEach(function(n,o){var a=e.getCellInfoByIndex(o,r);a&&t.push(a)})}),t}},{key:"getCellIndexByPos",value:function(t,e){var n=void 0,r=void 0,o=this;return this.data.row.forEach(function(a,i){a&&a.col&&a.col.forEach(function(a,l){var s=o.getCellInfoByIndex(l,i);s.x===t&&s.y===e&&(n=l,r=i)})}),{row:r,col:n}}},{key:"getCellByPos",value:function(t,e){var n=this.getCellIndexByPos(t,e);if(this.data.row[n.row])return this.data.row[n.row].col[n.col]}},{key:"hitTest",value:function(t,e){return t.x<e.x+e.width&&e.x<t.x+t.width&&t.y<e.y+e.height&&e.y<t.y+t.height}},{key:"markup",value:function(){var t=this.data;if(t.splited)return void(t.splited=!1);var e=this.getSelectedPoints(),n=this.getLargePoint.apply(null,e),r=this;t.row.forEach(function(t,e){if(!t||!t.col)return!1;t.col.forEach(function(t,o){var a=r.getCellInfoByIndex(o,e),i={};t.selected&&(a.x===n.x&&(i.left=!0),a.x+a.width===n.x+n.width&&(i.right=!0),a.y===n.y&&(i.top=!0),a.y+a.height===n.y+n.height&&(i.bottom=!0)),t.mark=i})})}},{key:"selectRange",value:function(t,e){var n=this.data;if(n.point){var r=this;n.row[t].col[e].selected=!0;var o=this.getSelectedPoints(),a=this.getLargePoint.apply(null,o);n.row.forEach(function(t,e){if(!t||!t.col)return!1;t.col.forEach(function(t,n){var o=r.getCellInfoByIndex(n,e);o&&r.hitTest(a,o)&&(t.selected=!0)})}),o.length>1&&this.update()}}},{key:"select",value:function(t,e){var n=this.data;n.point={x:e,y:t},n.row.forEach(function(n,r){if(!n||!n.col)return!1;n.col.forEach(function(n,o){r===t&&o===e||(n.selected=!1)})}),n.row[t].col[e].selected||(n.row[t].col[e].selected=!0)}},{key:"unselectCells",value:function(){this.data.row.forEach(function(t,e){if(!t||!t.col)return!1;t.col.forEach(function(t,e){t.selected=!1})})}},{key:"removeCell",value:function(t){for(var e=this.data.row,n=0,r=e.length;n<r;n++)for(var o=e[n].col,a=0,i=o.length;a<i;a++){var l=o[a];l===t&&(o.splice(a,1),a--,i--)}}},{key:"removeSelectedCellExcept",value:function(t){for(var e=this.data.row,n=0,r=e.length;n<r;n++)for(var o=e[n].col,a=0,i=o.length;a<i;a++){var l=o[a];l!==t&&l.selected&&(o.splice(a,1),a--,i--)}}},{key:"contextmenu",value:function(){var t=this.data;this.e.preventDefault(),t.showMenu=!0,t.menuX=this.e.clientX,t.menuY=this.e.clientY,this.update()}},{key:"parse",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"html",n=this,r=[],o=g.default.parseHTML(t),a=o.querySelectorAll("tr");return[].forEach.call(a,function(t){var o={},a=[],i=t.querySelectorAll("th,td");o.col=a,[].forEach.call(i,function(t){var r={},o="html"===e?t.innerHTML:t.innerText;"TH"===t.tagName?r.type="th":r.type="td",r.colspan=t.getAttribute("colspan")||1,r.rowspan=t.getAttribute("rowspan")||1,r.value="",o&&(r.value=o.replace(/{(.*?)}/g,"&lcub;$1&rcub;"),r.value=r.value.replace(/\\/g,"&#92;"));var i=t.getAttribute("class"),l="";if(i){i.split(/\s+/).forEach(function(t){var e=n.getAlignByStyle(t);e?r.align=e:l+=" "+t})}r.cellClass=l.substr(1),a.push(r)}),r.push(o)}),r}},{key:"parseText",value:function(t){var e=[];return t=t.replace(/"(([\n\r\t]|.)*?)"/g,function(t,e){return e.replace(/[\n\r]/g,"<br>")}),t.split(String.fromCharCode(13)).forEach(function(t){var n={},r=[];n.col=r,t.split(String.fromCharCode(9)).forEach(function(t){var e={};e.type="td",e.colspan=1,e.rowspan=1,e.value="",t&&(e.value=t.replace(/{(.*?)}/g,"&lcub;$1&rcub;")),r.push(e)}),e.push(n)}),e}},{key:"getTableClass",value:function(t){return g.default.parseHTML(t).getAttribute("class")}},{key:"toMarkdown",value:function(t){var e=g.default.parseHTML(t),n="",r=e.querySelectorAll("tr");return[].forEach.call(r,function(t,e){n+="| ";var r=t.querySelectorAll("td,th");[].forEach.call(r,function(t){n+=t.innerHTML,n+=" | "}),0===e&&(n+="\n| ",[].forEach.call(r,function(t){n+="--- | "})),n+="\n"}),n}},{key:"getTable",value:function(){return this.getHtml(w,!0).replace(/ class=""/g,"").replace(/class="(.*)? "/g,'class="$1"')}},{key:"getMarkdown",value:function(){return this.toMarkdown(this.getHtml(w,!0))}},{key:"putCaret",value:function(t){if(t)if(t.focus(),void 0!==window.getSelection&&void 0!==document.createRange){var e=document.createRange();e.selectNodeContents(t),e.collapse(!1);var n=window.getSelection();n.removeAllRanges(),n.addRange(e)}else if(void 0!==document.body.createTextRange){var r=document.body.createTextRange();r.moveToElementText(t),r.collapse(!1),r.select()}}},{key:"onUpdated",value:function(){var t=this,e=this.getAllPoints(),n=this.getLargePoint.apply(null,e),r=(n.width,this._getElementByQuery("table")),o=this._getSelf().parentNode,a=this._getElementByQuery(".a-table-selected .a-table-editable"),i=this.getSelectedPoints();if(a&&!this.data.showMenu&&1===i.length&&setTimeout(function(){t.putCaret(a)},1),r){o.style.width="9999px";var l=r.offsetWidth;o.style.width=l+"px"}else o.style.width="auto";this.afterRendered&&this.afterRendered()}},{key:"undo",value:function(){var t=this.data,e=t.row,n=t.history;if(0!==t.history.length){for(;JSON.stringify(e)===JSON.stringify(t.row);)e=n.pop();e&&(0===n.length&&n.push((0,f.default)(e)),t.row=e,this.update())}}},{key:"insertRow",value:function(t,e){var n=this.data,r=n.row;r[t]?r.splice(t,0,{col:e}):r.length===t&&r.push({col:e})}},{key:"insertCellAt",value:function(t,e,n){var r=this.data,o=r.row;o[t]&&o[t].col&&o[t].col.splice(e,0,n)}},{key:"unselect",value:function(){var t=this.data;this.unselectCells(),t.selectedColNo=-1,t.selectedRowNo=-1,t.showMenu=!1,this.update()}},{key:"selectRow",value:function(t){var e=this.data;this.unselectCells(),e.showMenu=!1;var n=this.getAllPoints(),r=this.getLargePoint.apply(null,n),o={x:parseInt(t),y:0,width:1,height:r.height},a=[],i=this;n.forEach(function(t){i.hitTest(o,t)&&a.push(t)}),a.forEach(function(t){i.getCellByPos(t.x,t.y).selected=!0}),e.mode="col",e.selectedColNo=-1,e.selectedRowNo=t,this.contextmenu(),this.update()}},{key:"selectCol",value:function(t){var e=this.getAllPoints(),n=this.getLargePoint.apply(null,e),r={x:0,y:parseInt(t),width:n.width,height:1},o=[],a=this,i=this.data;this.unselectCells(),i.showMenu=!1,e.forEach(function(t){a.hitTest(r,t)&&o.push(t)}),o.forEach(function(t){a.getCellByPos(t.x,t.y).selected=!0}),i.mode="row",i.selectedRowNo=-1,i.selectedColNo=t,this.contextmenu(),this.update()}},{key:"removeCol",value:function(t){var e=this.data;e.showMenu=!1;var n=this,r=this.getAllPoints(),o=this.getLargePoint.apply(null,r),a={x:parseInt(t),y:0,width:1,height:o.height},i=[];r.forEach(function(t){n.hitTest(a,t)&&i.push(t)}),i.forEach(function(t){var e=n.getCellByPos(t.x,t.y);1===e.colspan?n.removeCell(e):e.colspan=parseInt(e.colspan)-1}),e.history.push((0,f.default)(e.row)),this.update()}},{key:"removeRow",value:function(t){var e=this.data;e.showMenu=!1;var n=this,r=this.getAllPoints(),o=this.getLargePoint.apply(null,r);t=parseInt(t);var a={x:0,y:t,width:o.width,height:1},i={x:0,y:t+1,width:o.width,height:1},l=[],s=[],c=[];r.forEach(function(t){n.hitTest(a,t)&&l.push(t)}),r.forEach(function(t){if(n.hitTest(i,t)){var e=n.getCellByPos(t.x,t.y);e.x=t.x,t.y===i.y&&c.push(e)}}),l.forEach(function(e){var r=n.getCellByPos(e.x,e.y);1===r.rowspan?s.push(r):(r.rowspan=parseInt(r.rowspan)-1,t===e.y&&(r.x=e.x,c.push(r)))}),c.sort(function(t,e){return t.x>e.x?1:-1}),s.forEach(function(t){n.removeCell(t)}),e.row.splice(t,1),c.length>0&&(e.row[t]={col:c}),e.history.push((0,f.default)(e.row)),this.update()}},{key:"updateTable",value:function(t,n){var r=this.data,o=this.e,a=o.type,i=this.getSelectedPoints(),l=e.isSmartPhone();if("mouseup"!==a||!this.data.showMenu){var s=[parseInt(n),parseInt(t)];if(n=s[0],t=s[1],r.mode="cell",r.selectedRowNo=-1,r.selectedColNo=-1,r.showMenu=!1,"compositionstart"===a)r.beingInput=!0;else if("compositionend"===a)r.beingInput=!1;else if("click"!==a||l)if("keydown"===a&&67==o.keyCode&&(o.ctrlKey||o.metaKey)){var c=this._getElementByQuery(".a-table-selected .a-table-editable");g.default.triggerEvent(c,"copy")}else if("copy"===a)this.copyTable(o);else if("paste"===a)this.pasteTable(o);else if("mousedown"!==a||l)if("mousemove"!==a||l)if("mouseup"!==a||l){if("contextmenu"===a)this.mousedown=!1,this.contextmenu();else if("touchstart"===a)1===i.length&&this.data.row[n].col[t].selected||this.data.beingInput||(this.select(n,t),this.update());else if("input"===a)g.default.hasClass(this.e.target,"a-table-editable")&&this.e.target.parentNode.getAttribute("data-cell-id")===t+"-"+n&&(r.history.push((0,f.default)(r.row)),r.row[n].col[t].value=this.e.target.innerHTML.replace(/{(.*?)}/g,"&lcub;$1&rcub;"),r.row[n].col[t].value=r.row[n].col[t].value.replace(/\\/g,"&#92;")),this.afterEntered&&this.afterEntered();else if("keyup"===a){var u=e.getBrowser();-1===u.indexOf("ie")&&"edge"!==u||(g.default.hasClass(this.e.target,"a-table-editable")&&this.e.target.parentNode.getAttribute("data-cell-id")===t+"-"+n&&(r.history.push((0,f.default)(r.row)),r.row[n].col[t].value=this.e.target.innerHTML.replace(/{(.*?)}/g,"&lcub;$1&rcub;"),r.row[n].col[t].value=r.row[n].col[t].value.replace(/\\/g,"&#92;")),this.afterEntered&&this.afterEntered())}}else{this.mousedown=!1;var h=this._getElementByQuery(".a-table-selected .a-table-editable");i.length>1&&this.putCaret(h)}else this.mousedown&&this.selectRange(n,t);else 2===this.e.button||this.e.ctrlKey||(this.mousedown=!0,this.data.beingInput||1===i.length&&this.data.row[n].col[t].selected||(this.select(n,t),this.update()));else this.e.shiftKey&&this.selectRange(n,t)}}},{key:"copyTable",value:function(t){if(!(this.getSelectedPoints().length<=1)){t.preventDefault();var e='<meta name="generator" content="Sheets"><table>';this.data.row.forEach(function(t,n){if(!t.col)return!1;e+="<tr>",t.col.forEach(function(t,n){t.selected&&(e+="<"+t.type+' colspan="'+t.colspan+'" rowspan="'+t.rowspan+'">'+t.value+"</"+t.type+">")}),e+="</tr>"}),e+="</table>",e=e.replace(/<table>(<tr><\/tr>)*/g,"<table>"),e=e.replace(/(<tr><\/tr>)*<\/table>/g,"</table>"),t.clipboardData?t.clipboardData.setData("text/html",e):window.clipboardData&&window.clipboardData.setData("Text",e)}}},{key:"pasteTable",value:function(t){if(t.clipboardData){var e=t.clipboardData.getData("text/html");e||(e=t.clipboardData.getData("text/plain")),this.processPaste(e)}else window.clipboardData&&this.getClipBoardData()}},{key:"getClipBoardData",value:function(){for(var t=document.createDocumentFragment(),e=this.getSelectedPoint(),n=this.getCellIndexByPos(e.x,e.y),r=this.getCellByIndex(n.col,n.row),o=r.querySelector(".a-table-editable");o.childNodes.length>0;)t.appendChild(o.childNodes[0]);return this.waitForPastedData(o,t),!0}},{key:"waitForPastedData",value:function(t,e){var n=this;if(t.childNodes&&t.childNodes.length>0){var r=t.innerHTML;t.innerHTML="",t.appendChild(e),this.processPaste(r)}else setTimeout(function(){n.waitForPastedData(t,e)},20)}},{key:"processPaste",value:function(t){var e=this.e;e.preventDefault();var n=this.getSelectedPoint(),r=t.match(/<table(([\n\r\t]|.)*?)>(([\n\r\t]|.)*?)<\/table>/i),o=this.data;if(r&&r[0]){var a=this.parse(r[0],"text");if(a&&a.length)return this.insertTable(a,{x:n.x,y:n.y}),void o.history.push((0,f.default)(o.row))}var i=this.parseText(t);if(i&&i[0]&&i[0].col&&i[0].col.length>1){var l=this.getSelectedPoint();this.insertTable(i,{x:l.x,y:l.y}),this.update(),o.history.push((0,
  f.default)(o.row))}else if(e.clipboardData){var s=e.clipboardData.getData("text/plain");document.execCommand("insertText",!1,s)}else if(window.clipboardData){var c=window.clipboardData.getData("Text");g.default.replaceSelectionWithHtml(c)}}},{key:"insertTable",value:function(t,e){for(var n=this,r=this._getTableLength(this.data.row),o=this._getTableLength(t),a=e.x+o.x-r.x,i=e.y+o.y-r.y,l=r.x,s=(this.data.row,[]),c=[],u=this.data,h=(0,f.default)(u.row);i>0;){for(var d=[],p=0;p<l;p++){var g={type:"td",colspan:1,rowspan:1,value:""};d.push(g)}this.insertRow(r.y,d),i--}a>0&&this.data.row.forEach(function(t){for(var e=0;e<a;e++)t.col.push({type:"td",colspan:1,rowspan:1,value:""})}),this.update();var v={},y={x:e.x,y:e.y};if(y.y+=o.y-1,y.x+=o.x-1,this.data.row.forEach(function(t,e){if(!t.col)return!1;t.col.forEach(function(t,r){var o=n.getCellInfoByIndex(r,e);o.x+o.width-1===y.x&&o.y+o.height-1===y.y&&(v.x=r,v.y=e)})}),void 0===v.x)return alert(this.data.message.pasteError1),this.data.row=h,void this.update();this.selectRange(v.y,v.x);var w=this.getSelectedPoints(),b=this.getLargePoint.apply(null,w);if(b.width!==o.x||b.height!==o.y)return alert(this.data.message.pasteError1),this.data.row=h,void this.update();var m={x:0,y:b.y,width:b.x,height:b.height};this.getAllPoints().forEach(function(t){if(n.hitTest(m,t)){var e=n.getCellIndexByPos(t.x,t.y);n.getCellByPos(t.x,t.y),s.push(e)}}),s.forEach(function(t){var e=t.row;t.row<b.y||(c[e]||(c[e]=[]),c[e].push(t))});for(var x=1,E=c.length;x<E;x++)c[x]&&c[x].sort(function(t,e){return t.col>e.col?1:-1});for(var C=b.y,A=C+b.height;C<A;C++)c[C]||(c[C]=[],c[C].push({row:C,col:-1}));this.removeSelectedCellExcept();var k=0;c.forEach(function(e){var r=e[e.length-1];t[k]&&t[k].col.reverse().forEach(function(t){n.insertCellAt(r.row,r.col+1,{type:"td",colspan:parseInt(t.colspan),rowspan:parseInt(t.rowspan),value:t.value,selected:!0})}),k++}),this.update()}},{key:"updateResult",value:function(){var t=this.data;t.row=this.parse(t.tableResult),t.tableClass=this.getTableClass(t.tableResult),t.history.push((0,f.default)(t.row)),"table"===t.inputMode&&this.update(),this.afterEntered&&this.afterEntered()}},{key:"insertColRight",value:function(t){var e=this.data;e.selectedRowNo=parseInt(t),e.showMenu=!1;var n=this,r=this.getAllPoints(),o=this.getLargePoint.apply(null,r),a={x:parseInt(t),y:0,width:1,height:o.height},i=[];r.forEach(function(t){n.hitTest(a,t)&&i.push(t)}),i.forEach(function(t){var e=n.getCellIndexByPos(t.x,t.y),r=n.getCellByPos(t.x,t.y),o={type:"td",colspan:1,rowspan:r.rowspan,value:""};void 0!==e.row&&void 0!==e.col&&(t.width+t.x-a.x>1?(r.colspan=parseInt(r.colspan)+1,r.colspan+=""):n.insertCellAt(e.row,e.col+1,o))}),e.history.push((0,f.default)(e.row)),this.update()}},{key:"insertColLeft",value:function(t){var e=this.data;t=parseInt(t),e.selectedRowNo=t+1,e.showMenu=!1;var n=this,r=this.getAllPoints(),o=this.getLargePoint.apply(null,r),a={x:parseInt(t)-1,y:0,width:1,height:o.height},i=[];if(r.forEach(function(t){n.hitTest(a,t)&&i.push(t)}),0===t){for(var l=o.height,s=0;s<l;s++){var c={type:"td",colspan:1,rowspan:1,value:""};n.insertCellAt(s,0,c)}return e.history.push((0,f.default)(e.row)),void n.update()}i.forEach(function(t){var e=n.getCellIndexByPos(t.x,t.y),r=n.getCellByPos(t.x,t.y),o={type:"td",colspan:1,rowspan:r.rowspan,value:""};void 0!==e.row&&void 0!==e.col&&(t.width+t.x-a.x>1?(r.colspan=parseInt(r.colspan)+1,r.colspan+=""):n.insertCellAt(e.row,e.col+1,o))}),e.history.push((0,f.default)(e.row)),this.update()}},{key:"beforeUpdated",value:function(){this.changeSelectOption(),this.markup()}},{key:"insertRowBelow",value:function(t){var e=this.data;e.showMenu=!1,e.selectedColNo=parseInt(t);var n=this,r=this.getAllPoints(),o=this.getLargePoint.apply(null,r);t=parseInt(t);var a={x:0,y:t+1,width:o.width,height:1},i=[],l=[];if(r.forEach(function(t){n.hitTest(a,t)&&i.push(t)}),0===i.length){for(var s=o.width,c=0;c<s;c++){var u={type:"td",colspan:1,rowspan:1,value:""};l.push(u)}return n.insertRow(t+1,l),void n.update()}i.forEach(function(e){var r=n.getCellIndexByPos(e.x,e.y),o=n.getCellByPos(e.x,e.y);if(o){var a={type:"td",colspan:1,rowspan:1,value:""};if(void 0!==r.row&&void 0!==r.col)if(e.height>1&&e.y<=t)o.rowspan=parseInt(o.rowspan)+1,o.rowspan+="";else if(r.row===t+1)for(var i=parseInt(o.colspan),s=0;s<i;s++)l.push({type:"td",colspan:1,rowspan:1,value:""});else n.insertCellAt(r.row+1,r.col,a)}}),this.insertRow(t+1,l),e.history.push((0,f.default)(e.row)),this.update()}},{key:"insertRowAbove",value:function(t){var e=this.data;e.showMenu=!1,e.selectedColNo=parseInt(t)+1;var n=this,r=this.getAllPoints(),o=this.getLargePoint.apply(null,r);t=parseInt(t);var a={x:0,y:t-1,width:o.width,height:1},i=[],l=[];if(r.forEach(function(t){n.hitTest(a,t)&&i.push(t)}),0===t){for(var s=o.width,c=0;c<s;c++){var u={type:"td",colspan:1,rowspan:1,value:""};l.push(u)}return n.insertRow(0,l),void n.update()}i.forEach(function(e){var r=n.getCellIndexByPos(e.x,e.y),o=n.getCellByPos(e.x,e.y);if(o){var a={type:"td",colspan:1,rowspan:1,value:""};if(void 0!==r.row&&void 0!==r.col)if(e.height>1)o.rowspan=parseInt(o.rowspan)+1,o.rowspan+="";else if(r.row===t-1)for(var i=parseInt(o.colspan),s=0;s<i;s++)l.push({type:"td",colspan:1,rowspan:1,value:""});else n.insertCellAt(r.row,r.col,a)}}),this.insertRow(t,l),e.history.push((0,f.default)(this.data.row)),this.update()}},{key:"mergeCells",value:function(){var t=this.data,e=this.getSelectedPoints();if(!this.isSelectedCellsRectangle())return void alert(this.data.message.mergeCellError1);if(0!==e.length&&confirm(this.data.message.mergeCellConfirm1)){var n=this.getLargePoint.apply(null,e),r=this.getCellByPos(n.x,n.y);this.removeSelectedCellExcept(r),r.colspan=n.width,r.rowspan=n.height,t.showMenu=!1,t.history.push((0,f.default)(t.row)),this.update()}}},{key:"splitCell",value:function(){var t=this.data,e=this.getSelectedPoints(),n=e.length;if(0===n)return void alert(this.data.message.splitError1);if(n>1)return void alert(this.data.message.splitError2);var r=this.getSelectedPoint(),o={x:0,y:r.y,width:r.x,height:r.height},a=this.getAllPoints(),i=this.getCellIndexByPos(r.x,r.y),l=this.getCellByPos(r.x,r.y),s=parseInt(l.colspan),c=parseInt(l.rowspan),u=l.value,h=this,d=[],p=[];if(1===s&&1===c)return void alert(this.data.message.splitError3);a.forEach(function(t){if(h.hitTest(o,t)){var e=h.getCellIndexByPos(t.x,t.y);h.getCellByPos(t.x,t.y);d.push(e)}}),d.forEach(function(t){var e=t.row;t.row<i.row||(p[e]||(p[e]=[]),p[e].push(t))});for(var g=1,v=p.length;g<v;g++)p[g]&&p[g].sort(function(t,e){return t.col>e.col?1:-1});for(var y=r.y,w=y+c;y<w;y++)p[y]||(p[y]=[],p[y].push({row:y,col:-1}));var b=!0;p.forEach(function(t){for(var e=t[t.length-1],n=0;n<s;n++){var r="";!0===b&&n===s-1&&(r=u,b=!1),h.insertCellAt(e.row,e.col+1,{type:"td",colspan:1,rowspan:1,value:r,selected:!0})}}),this.removeCell(l),t.showMenu=!1,t.history.push((0,f.default)(t.row)),t.splited=!0,this.update()}},{key:"changeCellTypeTo",value:function(t){var e=this.data;e.row.forEach(function(e,n){e.col.forEach(function(e,n){e.selected&&(e.type=t)})}),e.showMenu=!1,e.history.push((0,f.default)(e.row)),this.update()}},{key:"align",value:function(t){var e=this.data;e.row.forEach(function(e,n){e.col.forEach(function(e,n){e.selected&&(e.align=t)})}),e.showMenu=!1,e.history.push((0,f.default)(e.row)),this.update()}},{key:"getStyleByAlign",value:function(t){var e=this.data.mark.align;return e.default===t?"":e[t]}},{key:"getAlignByStyle",value:function(t){var e=this.data.mark.align;return e.right===t?"right":e.center===t?"center":e.left===t?"left":void 0}},{key:"isSelectedCellsRectangle",value:function(){var t=this.getSelectedPoints(),e=this.getLargePoint.apply(null,t),n=this.getAllPoints(),r=!0,o=this;return n.forEach(function(t){if(o.hitTest(e,t)){o.getCellByPos(t.x,t.y).selected||(r=!1)}}),r}},{key:"changeInputMode",value:function(t){var e=this.data;e.inputMode=t,"source"===t?e.tableResult=this.getTable():(e.row=this.parse(e.tableResult),e.tableClass=this.getTableClass(e.tableResult)),this.update()}},{key:"changeCellClass",value:function(){var t=this.data,e=t.cellClass;t.row.forEach(function(t,n){t.col.forEach(function(t,n){t.selected&&(t.cellClass=e)})}),t.history.push((0,f.default)(t.row)),this.update()}},{key:"changeSelectOption",value:function(){var t=void 0,e=!0,n=this.data;n.row.forEach(function(n){n.col.forEach(function(n){n.selected&&(t?t&&t!==n.cellClass&&(e=!1):t=n.cellClass)})}),n.cellClass=e&&t?t:""}}],[{key:"isSmartPhone",value:function(){var t=navigator.userAgent;return t.indexOf("iPhone")>0||t.indexOf("iPad")>0||t.indexOf("ipod")>0||t.indexOf("Android")>0}},{key:"getBrowser",value:function(){var t=window.navigator.userAgent.toLowerCase(),e=window.navigator.appVersion.toLowerCase(),n="unknown";return-1!=t.indexOf("msie")?n=-1!=e.indexOf("msie 6.")?"ie6":-1!=e.indexOf("msie 7.")?"ie7":-1!=e.indexOf("msie 8.")?"ie8":-1!=e.indexOf("msie 9.")?"ie9":-1!=e.indexOf("msie 10.")?"ie10":"ie":-1!=t.indexOf("trident/7")?n="ie11":-1!=t.indexOf("edge")?n="edge":-1!=t.indexOf("chrome")?n="chrome":-1!=t.indexOf("safari")?n="safari":-1!=t.indexOf("opera")?n="opera":-1!=t.indexOf("firefox")&&(n="firefox"),n}},{key:"getUniqId",value:function(){return(Date.now().toString(36)+Math.random().toString(36).substr(2,5)).toUpperCase()}}]),e}(c.default);n.default=m,e.exports=n.default},{"./util.js":13,"a-template":1,clone:5,"deep-extend":7}],13:[function(t,e,n){"use strict";function r(t){t=t||{};for(var e=1;e<arguments.length;e++){var n=arguments[e];if(n)for(var a in n)n.hasOwnProperty(a)&&("object"===o(n[a])?t[a]=r(t[a],n[a]):t[a]=n[a])}return t}var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};t("custom-event-polyfill"),e.exports.before=function(t,e){t.insertAdjacentHTML("beforebegin",e)},e.exports.removeElement=function(t){t&&t.parentNode&&t.parentNode.removeChild(t)},e.exports.offset=function(t){var e=t.getBoundingClientRect();return{top:e.top+document.body.scrollTop,left:e.left+document.body.scrollLeft}},e.exports.parseHTML=function(t){var e=document.implementation.createHTMLDocument("");return e.body.innerHTML=t,e.body.children[0]},e.exports.hasClass=function(t,e){return t.classList?t.classList.contains(e):new RegExp("(^| )"+e+"( |$)","gi").test(t.className)},e.exports.replaceSelectionWithHtml=function(t){var e=void 0;if(window.getSelection&&window.getSelection().getRangeAt){e=window.getSelection().getRangeAt(0),e.deleteContents();var n=document.createElement("div");n.innerHTML=t;for(var r=document.createDocumentFragment(),o=void 0;o=n.firstChild;)r.appendChild(o);e.insertNode(r)}else document.selection&&document.selection.createRange&&(e=document.selection.createRange(),e.pasteHTML(t))},e.exports.extend=r,e.exports.triggerEvent=function(t,e,n){var r=void 0;window.CustomEvent?r=new CustomEvent(e,{cancelable:!0}):(r=document.createEvent("CustomEvent"),r.initCustomEvent(e,!1,!1,n)),t.dispatchEvent(r)},e.exports.removeIndentNewline=function(t){return t.replace(/(\n|\t)/g,"")}},{"custom-event-polyfill":6}]},{},[12])(12)});