/**
 * Skipped minification because the original files appears to be already minified.
 * Original file: /npm/@wolf-table/table-renderer@0.0.1/dist/table-renderer.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
(()=>{"use strict";var t={d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function r(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}t.r(e),t.d(e,{Area:()=>L,Canvas:()=>f,Range:()=>p,Viewport:()=>Q,default:()=>Z,eachRanges:()=>g,expr2expr:()=>u,expr2xy:()=>l,findRanges:()=>b,stringAt:()=>o,xy2expr:()=>s});var n="ABCDEFGHIJKLMNOPQRSTUVWXYZ";function i(t){return n.charAt(t%n.length)}function o(t){for(var e=[];t>=0;)e.push(i(t)),t=parseInt(t/n.length+"",10)-1;return e.reverse().join("")}function a(t){for(var e=0,r=0;r<t.length;r++)e=26*e+t.charCodeAt(r)-64;return e-1}function l(t){for(var e="",r="",n=0;n<t.length;n+=1)t.charAt(n)>="0"&&t.charAt(n)<="9"?r+=t.charAt(n):e+=t.charAt(n).toUpperCase();return[a(e),parseInt(r,10)-1]}function s(t,e){return"".concat(o(t)).concat(e+1)}function u(t,e,n){var i,o,a=(i=l(t),o=2,function(t){if(Array.isArray(t))return t}(i)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,i,o=[],a=!0,l=!1;try{for(r=r.call(t);!(a=(n=r.next()).done)&&(o.push(n.value),!e||o.length!==e);a=!0);}catch(t){l=!0,i=t}finally{try{a||null==r.return||r.return()}finally{if(l)throw i}}return o}}(i,o)||function(t,e){if(t){if("string"==typeof t)return r(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(t,e):void 0}}(i,o)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}());return s(a[0]+e,a[1]+n)}function c(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function h(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var f=function(){function t(e,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.target=e;var n=e.getContext("2d");if(!n)throw new Error("getContext(2d) is null");this._ctx=n,this._scale=r,this._target=e}var e,r;return e=t,(r=[{key:"size",value:function(t,e){var r=this._target,n=this._scale;r.style.width="".concat(t,"px"),r.style.height="".concat(e,"px");var i=window.devicePixelRatio;return r.width=Math.floor(t*i),r.height=Math.floor(e*i),this._ctx.scale(i*n,i*n),this}},{key:"prop",value:function(t,e){var r=this;return e?(this._ctx[t]=e,this):"string"==typeof t?this._ctx[t]:(Object.entries(t).forEach((function(t){var e,n,i=(n=2,function(t){if(Array.isArray(t))return t}(e=t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,i,o=[],a=!0,l=!1;try{for(r=r.call(t);!(a=(n=r.next()).done)&&(o.push(n.value),!e||o.length!==e);a=!0);}catch(t){l=!0,i=t}finally{try{a||null==r.return||r.return()}finally{if(l)throw i}}return o}}(e,n)||function(t,e){if(t){if("string"==typeof t)return c(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?c(t,e):void 0}}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),o=i[0],a=i[1];null!=a&&(r._ctx[o]=a)})),this)}},{key:"measureTextWidth",value:function(t){return this.measureText(t).width}},{key:"line",value:function(t,e,r,n){return this.moveTo(t,e).lineTo(r,n).stroke(),this}},{key:"clearRect",value:function(t,e,r,n){return this._ctx.clearRect(t,e,r,n),this}},{key:"fillRect",value:function(t,e,r,n){return this._ctx.fillRect(t,e,r,n),this}},{key:"strokeRect",value:function(t,e,r,n){return this._ctx.strokeRect(t,e,r,n),this}},{key:"fillText",value:function(t,e,r,n){return this._ctx.fillText(t,e,r,n),this}},{key:"strokeText",value:function(t,e,r,n){return this._ctx.strokeText(t,e,r,n),this}},{key:"measureText",value:function(t){return this._ctx.measureText(t)}},{key:"getLineDash",value:function(){return this._ctx.getLineDash()}},{key:"setLineDash",value:function(t){return this._ctx.setLineDash(t),this}},{key:"createLinearGradient",value:function(t,e,r,n){return this._ctx.createLinearGradient(t,e,r,n)}},{key:"createRadialGradient",value:function(t,e,r,n,i,o){return this._ctx.createRadialGradient(t,e,r,n,i,o)}},{key:"createPattern",value:function(t,e){return this._ctx.createPattern(t,e)}},{key:"beginPath",value:function(){return this._ctx.beginPath(),this}},{key:"closePath",value:function(){return this._ctx.closePath(),this}},{key:"moveTo",value:function(t,e){return this._ctx.moveTo(t,e),this}},{key:"lineTo",value:function(t,e){return this._ctx.lineTo(t,e),this}},{key:"bezierCurveTo",value:function(t,e,r,n,i,o){return this._ctx.bezierCurveTo(t,e,r,n,i,o),this}},{key:"quadraticCurveTo",value:function(t,e,r,n){return this._ctx.quadraticCurveTo(t,e,r,n),this}},{key:"arc",value:function(t,e,r,n,i,o){return this._ctx.arc(t,e,r,n,i,o),this}},{key:"arcTo",value:function(t,e,r,n,i){return this._ctx.arcTo(t,e,r,n,i),this}},{key:"ellipse",value:function(t,e,r,n,i,o,a,l){return this._ctx.ellipse(t,e,r,n,i,o,a,l),this}},{key:"rect",value:function(t,e,r,n){return this._ctx.rect(t,e,r,n),this}},{key:"roundRect",value:function(t,e,r,n,i){return this.beginPath().moveTo(t+i,e).arcTo(t+r,e,t+r,e+n,i).arcTo(t+r,e+n,t,e+n,i).arcTo(t,e+n,t,e,i).arcTo(t,e,t+r,e,i).closePath(),this}},{key:"fill",value:function(t){return this._ctx.fill(t),this}},{key:"stroke",value:function(){return this._ctx.stroke(),this}},{key:"clip",value:function(t){return this._ctx.clip(t),this}},{key:"isPointInPath",value:function(t,e,r){return this._ctx.isPointInPath(t,e,r)}},{key:"isPointInStroke",value:function(t,e){return this._ctx.isPointInStroke(t,e)}},{key:"getTransform",value:function(){return this._ctx.getTransform()}},{key:"rotate",value:function(t){return this._ctx.rotate(t),this}},{key:"scale",value:function(t,e){return this._ctx.scale(t,e),this}},{key:"translate",value:function(t,e){return this._ctx.translate(t,e),this}},{key:"setTransform",value:function(t,e,r,n,i,o){return this._ctx.setTransform(t,e,r,n,i,o),this}},{key:"drawImage",value:function(t,e,r){return this._ctx.drawImage(t,e,r),this}},{key:"createImageData",value:function(t,e){return this._ctx.createImageData(t,e)}},{key:"getImageData",value:function(t,e,r,n){return this._ctx.getImageData(t,e,r,n)}},{key:"putImageData",value:function(t,e,r){return this._ctx.putImageData(t,e,r),this}},{key:"save",value:function(){return this._ctx.save(),this}},{key:"restore",value:function(){return this._ctx.restore(),this}}])&&h(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function y(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,i,o=[],a=!0,l=!1;try{for(r=r.call(t);!(a=(n=r.next()).done)&&(o.push(n.value),!e||o.length!==e);a=!0);}catch(t){l=!0,i=t}finally{try{a||null==r.return||r.return()}finally{if(l)throw i}}return o}}(t,e)||d(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(t,e){if(t){if("string"==typeof t)return v(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?v(t,e):void 0}}function v(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function w(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var p=function(){function t(e,r,n,i){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.startRow=e,this.startCol=r,this.endRow=n,this.endCol=i}var e,r,n;return e=t,n=[{key:"create",value:function(e,r,n,i){if(void 0!==n&&void 0!==i){var o=e,a=r,l=n,s=i;return e>n&&(o=n,l=e),r>i&&(a=i,s=r),new t(o,a,l,s)}return new t(e,r,e,r)}},{key:"with",value:function(t){var e=t.split(":"),r=y(l(e[0]),2),n=r[0],i=r[1];if(1===e.length)return this.create(i,n);var o=y(l(e[1]),2),a=o[0],s=o[1];return this.create(i,n,s,a)}}],(r=[{key:"start",get:function(){return[this.startRow,this.startCol]}},{key:"end",get:function(){return[this.endRow,this.endCol]}},{key:"rows",get:function(){return this.endRow-this.startRow}},{key:"cols",get:function(){return this.endCol-this.startCol}},{key:"multiple",get:function(){return this.cols>0||this.rows>0}},{key:"containsRow",value:function(t){return this.startRow<=t&&t<=this.endRow}},{key:"containsCol",value:function(t){return this.startCol<=t&&t<=this.endCol}},{key:"contains",value:function(t,e){return this.containsRow(t)&&this.containsCol(e)}},{key:"within",value:function(t){return this.startRow>=t.startRow&&this.startCol>=t.startCol&&this.endRow<=t.endRow&&this.endCol<=t.endCol}},{key:"position",value:function(t){if(this.startRow<=t.startRow&&this.endRow>=t.endRow){if(t.startCol>this.endCol)return"right";if(t.endCol<this.startCol)return"left"}else if(this.startCol<=t.startCol&&this.endCol>=t.endCol){if(t.startRow>this.endRow)return"down";if(t.endRow<this.startRow)return"up"}return"none"}},{key:"intersectsRow",value:function(t,e){return this.startRow<=e&&t<=this.endRow}},{key:"intersectsCol",value:function(t,e){return this.startCol<=e&&t<=this.endCol}},{key:"intersects",value:function(t){var e=t.startRow,r=t.startCol,n=t.endRow,i=t.endCol;return this.intersectsCol(r,i)&&this.intersectsRow(e,n)}},{key:"intersection",value:function(e){return new t(e.startRow<this.startRow?this.startRow:e.startRow,e.startCol<this.startCol?this.startCol:e.startCol,e.endRow>this.endRow?this.endRow:e.endRow,e.endCol>this.endCol?this.endCol:e.endCol)}},{key:"union",value:function(e){return new t(e.startRow<this.startRow?e.startRow:this.startRow,e.startCol<this.startCol?e.startCol:this.startCol,e.endRow>this.endRow?e.endRow:this.endRow,e.endCol>this.endCol?e.endCol:this.endCol)}},{key:"difference",value:function(e){if(!this.intersects(e))return[];var r=this.startRow,n=this.startCol,i=this.endRow,o=this.endCol,a=this.intersection(e);return[new t(r,n,a.startRow-1,o),new t(a.endRow+1,n,i,o),new t(a.startRow,n,a.endRow,a.startCol-1),new t(a.startRow,a.endCol+1,a.endRow,o)].filter((function(t){return t.rows>=0&&t.cols>=0}))}},{key:"touches",value:function(t){return t.startRow===this.startRow&&t.endRow===this.endRow&&(t.endCol+1===this.startCol||this.endCol+1===t.startCol)||t.startCol===this.startCol&&t.endCol===this.endCol&&(t.endRow+1===this.startRow||this.endRow+1===this.startCol)}},{key:"eachRow",value:function(t,e){var r=this.endRow;e&&r>e&&(r=e);for(var n=this.startRow;n<=r;n+=1)t(n);return this}},{key:"eachCol",value:function(t,e){var r=this.endCol;e&&r>e&&(r=e);for(var n=this.startCol;n<=r;n+=1)t(n);return this}},{key:"each",value:function(t){var e=this;return this.eachRow((function(r){e.eachCol((function(e){return t(r,e)}))})),this}},{key:"clone",value:function(){return new t(this.startRow,this.startCol,this.endRow,this.endCol)}},{key:"toString",value:function(){var t=s(this.startCol,this.startRow);return this.multiple&&(t+=":".concat(s(this.endCol,this.endRow))),t}},{key:"equals",value:function(t){return this.startRow===t.startRow&&this.startCol===t.startCol&&this.endRow===t.endRow&&this.endCol===t.endCol}}])&&w(e.prototype,r),n&&w(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function g(t,e){t&&t.length>0&&t.forEach((function(t){e(p.with(t))}))}function b(t,e){if(t&&t.length>0){var r,n=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=d(t))){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},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 o,a=!0,l=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){l=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(l)throw o}}}}(t);try{for(n.s();!(r=n.n()).done;){var i=r.value,o=p.with(i);if(e(o))return o}}catch(t){n.e(t)}finally{n.f()}}return null}function m(t){return function(t){if(Array.isArray(t))return k(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||_(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _(t,e){if(t){if("string"==typeof t)return k(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?k(t,e):void 0}}function k(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function C(t,e,r,n){if(t&&e){var i="";return r&&(i+="italic "),n&&(i+="bold "),"".concat(i," ").concat(e,"pt ").concat(t)}}function R(t,e,r){var n,i,o,a,l=arguments.length>3&&void 0!==arguments[3]&&arguments[3];Array.isArray(r)?n=i=o=a=r:(n=r.top,i=r.right,o=r.bottom,a=r.left),t.save().beginPath().translate(e.x,e.y);var s=function(t,r){return[[0-r,0,e.width+r,0],[e.width,0,e.width,e.height],[0-r,e.height,e.width+r,e.height],[0,0,0,e.height]][t]};[n,i,o,a].forEach((function(e,r){if(e){var n,i=[],o=1;"thick"===e[0]?o=3:"medium"===e[0]?o=2:"dotted"===e[0]?i=[1,1]:"dashed"===e[0]&&(i=[2,2]);var a=0;l&&(a=o/2),(n=t.prop({strokeStyle:e[1],lineWidth:o}).setLineDash(i)).line.apply(n,m(s(r,a)))}})),t.restore()}function x(t,e,r,n,i,o){var a="";e&&(a="string"==typeof e||"number"==typeof e?o("".concat(e)):o((e.value||"")+"",e.format));var l,s,u=n.fontSize,c=n.fontFamily,h=n.bold,f=n.italic,y=n.color,d=n.bgcolor,v=n.align,w=n.valign,p=n.underline,g=n.strikethrough,b=n.rotate,k=n.textwrap,R=n.padding;if(t.save().beginPath().translate(r.x,r.y),t.rect(0,0,r.width,r.height).clip(),d&&t.prop("fillStyle",d).fill(),b&&b>0&&t.rotate(b*(Math.PI/180)),void 0!==i){if(t.save(),!i(t,r,e,a))return void t.restore();t.restore()}if(a&&!/^\s*$/.test(a)){t.save().beginPath().prop({textAlign:v,textBaseline:w,font:C(c,u,f,h),fillStyle:y});var x=(s=2,function(t){if(Array.isArray(t))return t}(l=R||[5,5])||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,i,o=[],a=!0,l=!1;try{for(r=r.call(t);!(a=(n=r.next()).done)&&(o.push(n.value),!e||o.length!==e);a=!0);}catch(t){l=!0,i=t}finally{try{a||null==r.return||r.return()}finally{if(l)throw i}}return o}}(l,s)||_(l,s)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),A=x[0],S=x[1],j=function(t,e,r){switch(t){case"left":return r;case"center":return e/2;case"right":return e-r;default:return 0}}(v,r.width,A),O=a.split("\n"),P=r.width-2*A,T=[];O.forEach((function(e){var r=t.measureTextWidth(e);if(k&&r>P){for(var n={w:0,len:0,start:0},i=0;i<e.length;i+=1)n.w>P&&(T.push(e.substr(n.start,n.len)),n={w:0,len:0,start:i}),n.len+=1,n.w+=t.measureTextWidth(e[i])+1;n.len>0&&T.push(e.substr(n.start,n.len))}else T.push(e)}));var I=u/.75,E=(T.length-1)*I,H=[];p&&H.push("underline"),g&&H.push("strikethrough");var M=function(t,e,r,n,i){switch(t){case"top":return i;case"middle":var o=e/2-r/2,a=n/2+i;return o<a?a:o;case"bottom":return e-i-r;default:return 0}}(w,r.height,E,I,S);T.forEach((function(e){var r=t.measureTextWidth(e);t.fillText(e,j,M),H.forEach((function(e){t.line.apply(t,m(function(t,e,r,n,i,o,a){var l=0;"underline"===t?"top"===r?l=-a:"middle"===r&&(l=-a/2):"strikethrough"===t&&("top"===r?l=-a/2:"bottom"===r&&(l=a/2));var s=0;return"center"===e?s=o/2:"right"===e&&(s=o),[n-s,i-l,n-s+o,i-l]}(e,v,w,j,M,r,u)))})),M+=I})),t.restore()}t.restore()}function A(t){return function(t){if(Array.isArray(t))return j(t)}(t)||O(t)||S(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function S(t,e){if(t){if("string"==typeof t)return j(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?j(t,e):void 0}}function j(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function O(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function P(t,e,r){var n,i=function(t){if(Array.isArray(t))return t}(n=e)||O(n)||S(n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),o=i[0],a=i[1],l=i.slice(2),s=[],u=p.with(o),c=r.filter((function(t){return t.intersects(u)}));if(u.intersects(t.range)||c.length>0)if(c.length<=0)s.push([u,t.rect(u),a]);else{var h,f=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=S(t))){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},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 o,a=!0,l=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){l=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(l)throw o}}}}(c);try{var y=function(){var e=h.value;if(!u.within(e)){if("outside"===a||"left"===a||"top"===a||"right"===a||"bottom"===a)return s.push([u,t.rect(u),a]),"break";var r=c.filter((function(t){return!t.equals(e)}));if(u.difference(e).forEach((function(n){if(n.intersects(t.range)){var i=t.rect(n);s.push.apply(s,A(P(t,[n.toString(),a].concat(A(l)),r))),"inside"!==a&&"horizontal"!==a||(n.startRow<e.startRow&&n.endRow<e.startRow?s.push([n,i,"bottom"]):n.startRow>e.startRow&&n.endRow>e.startRow&&s.push([n,i,"top"])),"inside"!==a&&"vertical"!==a||(n.startCol<e.startCol&&n.endCol<e.startCol&&s.push([n,i,"right"]),n.startCol>e.startCol&&n.endCol>e.startCol&&s.push([n,i,"left"]))}})),"all"===a){var n=t.rect(e);u.startRow===e.startRow&&s.push([e,n,"top"]),u.endRow===e.endRow&&s.push([e,n,"bottom"]),u.startCol===e.startCol&&s.push([e,n,"left"]),u.endCol===e.endCol&&s.push([e,n,"right"])}return"break"}u.startRow===e.startRow&&u.startCol===e.startCol&&"inside"!==a&&"horizontal"!==a&&"vertical"!==a&&s.push([e,t.rect(e),"all"===a?"outside":a])};for(f.s();!(h=f.n()).done&&"break"!==y(););}catch(t){f.e(t)}finally{f.f()}}return s}function T(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function I(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function E(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,i,o=[],a=!0,l=!1;try{for(r=r.call(t);!(a=(n=r.next()).done)&&(o.push(n.value),!e||o.length!==e);a=!0);}catch(t){l=!0,i=t}finally{try{a||null==r.return||r.return()}finally{if(l)throw i}}return o}}(t,e)||H(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function H(t,e){if(t){if("string"==typeof t)return M(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?M(t,e):void 0}}function M(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function z(t,e,r){var n=e.width,i=e.color;n>0&&(t.save().beginPath().prop({lineWidth:n-.5,strokeStyle:i}),r(),t.restore())}function D(t,e,r){var n=r.x,i=r.y,o=r.width,a=r.height;z(t,e,(function(){t.translate(n,i).line(o,0,o,a).line(0,a,o,a)}))}function W(t,e,r,n){if(r){var i,o,a,l,s,u,c=function(t){return t},h=n._headerStyle,f=n._headerGridline,y=n._styles,d=n._rowHeader,v=n._colHeader;if("row-header"===t){if(d.width<=0)return;i=d.cell,a=d.merges,o=d.cellRenderer}else if("col-header"===t){if(v.height<=0)return;i=v.cell,a=v.merges,o=v.cellRenderer}else i=n._cell,o=n._cellRenderer,c=n._formatter,h=n._style,f=n._gridline,y=n._styles,a=n._merges,l=n._borders,s=n._row,u=n._col;e.save().translate(r.x,r.y).prop("fillStyle",n._bgcolor).rect(0,0,r.width,r.height).fill().clip();var w=function(t,e,r){var n=function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?T(Object(r),!0).forEach((function(e){I(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):T(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}({},h);if(s){var i=s(t);i&&void 0!==i.style&&Object.assign(n,y[i.style])}if(u){var o=u(e);o&&void 0!==o.style&&Object.assign(n,y[o.style])}return r instanceof Object&&void 0!==r.style&&Object.assign(n,y[r.style]),n},p=[],b=[],m=new Set;a&&g(a,(function(t){if(t.intersects(r.range)){var e=i(t.startRow,t.startCol),n=w(t.startRow,t.startCol,e),o=r.rect(t);b.push([e,o,n]),p.push(t),t.each((function(t,e){m.add("".concat(t,"_").concat(e))}))}}));var _=function(r,n,i){"body"===t?(D(e,f,n),x(e,r,n,i,o,c)):(x(e,r,n,i,o,c),D(e,f,n))};r.each((function(t,e,r){if(!m.has("".concat(t,"_").concat(e))){var n=i(t,e);_(n,r,w(t,e,n))}})),b.forEach((function(t){return _.apply(void 0,function(t){if(Array.isArray(t))return M(t)}(e=t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(e)||H(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}());var e})),function(t,e,r,n){r&&r.length>0&&r.forEach((function(r){var i=E(r,4),o=i[2],a=i[3];P(e,r,n).forEach((function(r){var n=E(r,3),i=n[0],l=n[1],s=n[2];!function(t,e,r,n,i,o,a,l){var s=[o,a];"outside"===i||"all"===i?R(t,n,s,!0):"left"===i?R(t,n,{left:s},l):"top"===i?R(t,n,{top:s},l):"right"===i?R(t,n,{right:s},l):"bottom"===i&&R(t,n,{bottom:s},l),"all"!==i&&"inside"!==i&&"horizontal"!==i&&"vertical"!==i||("horizontal"!==i&&r.eachCol((function(n){if(n<r.endCol){var i=r.clone();i.endCol=i.startCol=n,i.intersects(e.range)&&R(t,e.rect(i),{right:s},l)}})),"vertical"!==i&&r.eachRow((function(n){if(n<r.endRow){var i=r.clone();i.endRow=i.startRow=n,i.intersects(e.range)&&R(t,e.rect(i),{bottom:s},l)}})))}(t,e,i,l,s,o,a)}))}))}(e,r,l,p),e.restore()}}function G(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function U(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var L=function(){function t(e,r,n,i,o,a,l){var s=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),U(this,"rowMap",new Map),U(this,"colMap",new Map),U(this,"cellAtCache",null),this.range=e,this.x=r,this.y=n,this.width=i,this.height=o,this.rowHeight=a,this.colWidth=l;var u=0;e.eachRow((function(t){var e=a(t);s.rowMap.set(t,{y:u,height:e}),u+=e})),this.height<=0&&(this.height=u);var c=0;e.eachCol((function(t){var e=l(t);s.colMap.set(t,{x:c,width:e}),c+=e})),this.width<=0&&(this.width=c)}var e,r,n;return e=t,n=[{key:"create",value:function(e,r,n,i,o,a,l,s,u,c){return new t(new p(e,r,n,i),o,a,l,s,u,c)}}],(r=[{key:"containsx",value:function(t){return t>=this.x&&t<this.x+this.width}},{key:"containsy",value:function(t){return t>=this.y&&t<this.y+this.height}},{key:"contains",value:function(t,e){return this.containsx(t)&&this.containsy(e)}},{key:"eachRow",value:function(t){var e=this;this.range.eachRow((function(r){var n=e.rowMap.get(r)||{y:0,height:0},i=n.y,o=n.height;o>0&&t(r,i,o)}))}},{key:"eachCol",value:function(t){var e=this;this.range.eachCol((function(r){var n=e.colMap.get(r)||{x:0,width:0},i=n.x,o=n.width;o>0&&t(r,i,o)}))}},{key:"each",value:function(t){var e=this;this.eachRow((function(r,n,i){e.eachCol((function(e,o,a){t(r,e,{x:o,y:n,width:a,height:i})}))}))}},{key:"rectRow",value:function(t,e){var r,n=this.rowMap,i=this.range,o=0,a=0;t>=i.startRow&&(o=(null===(r=n.get(t))||void 0===r?void 0:r.y)||0);for(var l=t;l<=e;l+=1){var s=this.rowHeight(l);s>0&&(l<i.startRow&&(o-=s),a+=s)}return{x:0,y:o,width:this.width,height:a}}},{key:"rectCol",value:function(t,e){var r,n=this.colMap,i=this.range,o=0,a=0;t>=i.startCol&&(o=(null===(r=n.get(t))||void 0===r?void 0:r.x)||0);for(var l=t;l<=e;l+=1){var s=this.colWidth(l);s>0&&(l<i.startCol&&(o-=s),a+=s)}return{x:o,y:0,width:a,height:this.height}}},{key:"rect",value:function(t){var e=this.rectRow(t.startRow,t.endRow),r=e.y,n=e.height,i=this.rectCol(t.startCol,t.endCol);return{x:i.x,y:r,width:i.width,height:n}}},{key:"cellAt",value:function(t,e){var r=this.cellAtCache;if(null!=r&&t>r.x&&t<=r.x+r.width&&e>r.y&&e<=r.y+r.height)return r;for(var n=this.range,i={row:n.startRow,col:n.startCol,x:this.x,y:this.y,width:0,height:0};i.y<e;){var o=this.rowHeight(i.row++);i.y+=o,i.height=o}for(i.y-=i.height,i.row--;i.x<t;){var a=this.colWidth(i.col++);i.x+=a,i.width=a}return i.x-=i.width,i.col--,this.cellAtCache=i,i}}])&&G(e.prototype,r),n&&G(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();function $(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function q(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?$(Object(r),!0).forEach((function(e){F(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):$(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function F(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function B(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=J(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},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 o,a=!0,l=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){l=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(l)throw o}}}}function V(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,i,o=[],a=!0,l=!1;try{for(r=r.call(t);!(a=(n=r.next()).done)&&(o.push(n.value),!e||o.length!==e);a=!0);}catch(t){l=!0,i=t}finally{try{a||null==r.return||r.return()}finally{if(l)throw i}}return o}}(t,e)||J(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function J(t,e){if(t){if("string"==typeof t)return K(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?K(t,e):void 0}}function K(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function N(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var Q=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._render=e;for(var r=[e._rowHeader.width,e._colHeader.height],n=r[0],i=r[1],o=V(e._freeze,2),a=o[0],l=o[1],s=e._startRow,u=e._startCol,c=e._rows,h=e._cols,f=e._width,y=e._height,d=function(t){return e.rowHeightAt(t)},v=function(t){return e.colWidthAt(t)},w=L.create(s,u,a-1,l-1,n,i,0,0,d,v),p=a+e._scrollRows,g=l+e._scrollCols,b=w.height+i,m=p;b<y&&m<c;)b+=d(m),m+=1;for(var _=w.width+n,k=g;_<f&&k<h;)_+=v(k),k+=1;var C=n+w.width,R=i+w.height,x=f-C,A=y-R;k===h&&(x-=f-_),m===c&&(A-=y-b),k-=1,m-=1;var S=L.create(p,g,m,k,C,R,x,A,d,v),j=L.create(s,g,a-1,k,C,i,x,0,d,v),O=L.create(p,u,m,l-1,n,R,0,A,d,v);this.areas=[j,w,O,S];var P=e._rowHeader,T=e._colHeader,I=function(){return T.height/T.rows},E=function(){return P.width/P.cols};this.headerAreas=[L.create(0,j.range.startCol,T.rows-1,j.range.endCol,S.x,0,S.width,0,I,v),L.create(0,w.range.startCol,T.rows-1,w.range.endCol,w.x,0,w.width,0,I,v),L.create(w.range.startRow,0,w.range.endRow,P.cols-1,0,w.y,0,w.height,d,E),L.create(O.range.startRow,0,O.range.endRow,P.cols-1,0,S.y,0,S.height,d,E)]}var e,r;return e=t,(r=[{key:"inAreas",value:function(t,e){var r,n=B(this.areas);try{for(n.s();!(r=n.n()).done;)if(r.value.range.contains(t,e))return!0}catch(t){n.e(t)}finally{n.f()}return!1}},{key:"cellAt",value:function(t,e){var r=this.areas[1],n=V(this.headerAreas,4),i=n[0],o=n[1],a=n[2],l=n[3];if(t<r.x&&e<r.y)return{placement:"all",row:0,col:0,x:0,y:0,width:r.x,height:r.y};if(t<r.x)return q({placement:"row-header"},(a.containsy(e)?a:l).cellAt(t,e));if(e<r.y)return q({placement:"col-header"},(o.containsx(t)?o:i).cellAt(t,e));var s,u=B(this.areas);try{for(u.s();!(s=u.n()).done;){var c=s.value;if(c.contains(t,e))return q({placement:"body"},c.cellAt(t,e))}}catch(t){u.e(t)}finally{u.f()}return null}}])&&N(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function X(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Y(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var Z=function(){function t(e,r,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),Y(this,"_bgcolor","#ffffff"),Y(this,"_width",0),Y(this,"_height",0),Y(this,"_scale",1),Y(this,"_rows",100),Y(this,"_cols",26),Y(this,"_rowHeight",22),Y(this,"_colWidth",100),Y(this,"_startRow",0),Y(this,"_startCol",0),Y(this,"_scrollRows",0),Y(this,"_scrollCols",0),Y(this,"_row",(function(){})),Y(this,"_col",(function(){})),Y(this,"_cell",(function(){})),Y(this,"_cellRenderer",(function(){return!0})),Y(this,"_formatter",(function(t){return t})),Y(this,"_merges",[]),Y(this,"_borders",[]),Y(this,"_styles",[]),Y(this,"_gridline",{width:1,color:"#e6e6e6"}),Y(this,"_style",{align:"left",valign:"middle",textwrap:!1,underline:!1,strikethrough:!1,color:"#0a0a0a",bold:!1,italic:!1,rotate:0,fontSize:10,fontFamily:"Source Sans Pro"}),Y(this,"_rowHeader",{width:60,cols:1,cell:function(t,e){return t+1}}),Y(this,"_colHeader",{height:24,rows:1,cell:function(t,e){return o(e)}}),Y(this,"_headerGridline",{width:1,color:"#e6e6e6"}),Y(this,"_headerStyle",{bgcolor:"#f4f5f8cc",align:"center",valign:"middle",textwrap:!0,underline:!1,strikethrough:!1,color:"#585757",bold:!1,italic:!1,rotate:0,fontSize:10,fontFamily:"Source Sans Pro"}),Y(this,"_freeze",[0,0]),Y(this,"_freezeGridline",{width:2,color:"#d8d8d8"}),Y(this,"_viewport",null);var i="string"==typeof e?document.querySelector(e):e;if(!i)throw new Error("target error");this._target=i,this._width=r,this._height=n}var e,r,n;return e=t,n=[{key:"create",value:function(e,r,n){return new t(e,r,n)}}],(r=[{key:"render",value:function(){return this._viewport=new Q(this),function(t){var e=t._width,r=t._height,n=t._target,i=t._scale,o=t._viewport,a=t._freeze,l=t._rowHeader,s=t._colHeader;if(o){var u=new f(n,i);u.size(e,r);var c=E(o.areas,4),h=c[0],y=c[1],d=c[2],v=c[3],w=E(o.headerAreas,4),p=w[0],g=w[1],b=w[2],m=w[3];W("body",u,v,t),W("body",u,h,t),W("col-header",u,p,t),W("body",u,d,t),W("row-header",u,m,t),W("body",u,y,t),W("col-header",u,g,t),W("row-header",u,b,t);var _=E(a,2),k=_[0],C=_[1];(C>0||k>0)&&z(u,t._freezeGridline,(function(){C>0&&u.line(0,v.y,e,v.y),k>0&&u.line(v.x,0,v.x,r)}));var R=y.x,x=y.y;if(R>0&&x>0){var A=s.height,S=l.width,j=t._headerStyle.bgcolor;j&&u.save().prop({fillStyle:j}).rect(0,0,S,A).fill().restore(),z(u,t._headerGridline,(function(){u.line(0,A,S,A).line(S,0,S,A)}))}}}(this),this}},{key:"bgcolor",value:function(t){return this._bgcolor=t,this}},{key:"width",value:function(t){return this._width=t,this}},{key:"height",value:function(t){return this._height=t,this}},{key:"scale",value:function(t){return this._scale=t,this}},{key:"rows",value:function(t){return this._rows=t,this}},{key:"cols",value:function(t){return this._cols=t,this}},{key:"rowHeight",value:function(t){return this._rowHeight=t,this}},{key:"colWidth",value:function(t){return this._colWidth=t,this}},{key:"startRow",value:function(t){return this._startRow=t,this}},{key:"startCol",value:function(t){return this._startCol=t,this}},{key:"scrollRows",value:function(t){return this._scrollRows=t,this}},{key:"scrollCols",value:function(t){return this._scrollCols=t,this}},{key:"row",value:function(t){return this._row=t,this}},{key:"col",value:function(t){return this._col=t,this}},{key:"cell",value:function(t){return this._cell=t,this}},{key:"cellRenderer",value:function(t){return this._cellRenderer=t,this}},{key:"formatter",value:function(t){return this._formatter=t,this}},{key:"merges",value:function(t){return this._merges=t,this}},{key:"styles",value:function(t){return this._styles=t,this}},{key:"borders",value:function(t){return this._borders=t,this}},{key:"gridline",value:function(t){return t&&Object.assign(this._gridline,t),this}},{key:"style",value:function(t){return t&&Object.assign(this._style,t),this}},{key:"rowHeader",value:function(t){return t&&Object.assign(this._rowHeader,t),this}},{key:"colHeader",value:function(t){return t&&Object.assign(this._colHeader,t),this}},{key:"headerGridline",value:function(t){return t&&Object.assign(this._headerGridline,t),this}},{key:"headerStyle",value:function(t){return t&&Object.assign(this._headerStyle,t),this}},{key:"freeze",value:function(t){return t&&(this._freeze=l(t).reverse()),this}},{key:"freezeGridline",value:function(t){return t&&Object.assign(this._freezeGridline,t),this}},{key:"rowHeightAt",value:function(t){var e=this._row;if(e){var r=e(t);if(r)return!0===r.hide?0:r.height}return this._rowHeight}},{key:"colWidthAt",value:function(t){var e=this._col;if(e){var r=e(t);if(r)return!0===r.hide?0:r.width}return this._colWidth}},{key:"viewport",get:function(){return this._viewport}}])&&X(e.prototype,r),n&&X(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();try{var tt;window&&((tt=window).wolf||(tt.wolf={}),window.wolf.table_renderer=Z.create)}catch(t){}module.exports=e})();