1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
| (this.webpackJsonp=this.webpackJsonp||[]).push([["chunk-32e1"],{"/HSZ":function(e,t,n){var r,i,o;i=[e,t,n("yZrW")],void 0===(o="function"==typeof(r=function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(e){return e&&e.__esModule?e:{default:e}}(n);function i(e,t){var n=new r.default(e,t).encode(),i=new Blob(["\ufeff"+n],{type:"text/plain;charset=utf-8"});return window.URL.createObjectURL(i)}t.default={genUrl:i,downloadCsv:function(e,t,n){var r=i(e,t),o=document.createElement("a");o.href=r,o.download=n,o.click(),window.URL.revokeObjectURL(r)}},e.exports=t.default})?r.apply(t,i):r)||(e.exports=o)},Ux1M:function(e,t,n){!function(t,n){e.exports=n()}(window,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}({"./src/index.js":
| /*!**********************!*\
| !*** ./src/index.js ***!
| \**********************/
| /*! exports provided: default */function(e,t,n){"use strict";n.r(t);n(/*! ./sass/index.scss */"./src/sass/index.scss");var r=n(/*! ./js/init */"./src/js/init.js").default.init;"undefined"!=typeof window&&(window.printJS=r),t.default=r},"./src/js/browser.js":
| /*!***************************!*\
| !*** ./src/js/browser.js ***!
| \***************************/
| /*! exports provided: default */function(e,t,n){"use strict";n.r(t);var r={isFirefox:function(){return"undefined"!=typeof InstallTrigger},isIE:function(){return-1!==navigator.userAgent.indexOf("MSIE")||!!document.documentMode},isEdge:function(){return!r.isIE()&&!!window.StyleMedia},isChrome:function(){return!!(arguments.length>0&&void 0!==arguments[0]?arguments[0]:window).chrome},isSafari:function(){return Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor")>0||-1!==navigator.userAgent.toLowerCase().indexOf("safari")},isIOSChrome:function(){return-1!==navigator.userAgent.toLowerCase().indexOf("crios")}};t.default=r},"./src/js/functions.js":
| /*!*****************************!*\
| !*** ./src/js/functions.js ***!
| \*****************************/
| /*! exports provided: addWrapper, capitalizePrint, collectStyles, addHeader, cleanUp, isRawHTML */function(e,t,n){"use strict";n.r(t),n.d(t,"addWrapper",function(){return a}),n.d(t,"capitalizePrint",function(){return l}),n.d(t,"collectStyles",function(){return s}),n.d(t,"addHeader",function(){return u}),n.d(t,"cleanUp",function(){return d}),n.d(t,"isRawHTML",function(){return f});var r=n(/*! ./modal */"./src/js/modal.js"),i=n(/*! ./browser */"./src/js/browser.js");function o(e){"@babel/helpers - typeof";return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t){return'<div style="'+("font-family:"+t.font+" !important; font-size: "+t.font_size+" !important; width:100%;")+'">'+e+"</div>"}function l(e){return e.charAt(0).toUpperCase()+e.slice(1)}function s(e,t){for(var n="",r=(document.defaultView||window).getComputedStyle(e,""),i=0;i<r.length;i++)(-1!==t.targetStyles.indexOf("*")||-1!==t.targetStyle.indexOf(r[i])||c(t.targetStyles,r[i]))&&r.getPropertyValue(r[i])&&(n+=r[i]+":"+r.getPropertyValue(r[i])+";");return n+="max-width: "+t.maxWidth+"px !important; font-size: "+t.font_size+" !important;"}function c(e,t){for(var n=0;n<e.length;n++)if("object"===o(t)&&-1!==t.indexOf(e[n]))return!0;return!1}function u(e,t){var n=document.createElement("div");if(f(t.header))n.innerHTML=t.header;else{var r=document.createElement("h1"),i=document.createTextNode(t.header);r.appendChild(i),r.setAttribute("style",t.headerStyle),n.appendChild(r)}e.insertBefore(n,e.childNodes[0])}function d(e){e.showModal&&r.default.close(),e.onLoadingEnd&&e.onLoadingEnd(),(e.showModal||e.onLoadingStart)&&window.URL.revokeObjectURL(e.printable);var t="mouseover";(i.default.isChrome()||i.default.isFirefox())&&(t="focus");window.addEventListener(t,function n(){window.removeEventListener(t,n),e.onPrintDialogClose();var r=document.getElementById(e.frameId);r&&r.remove()})}function f(e){return new RegExp("<([A-Za-z][A-Za-z0-9]*)\\b[^>]*>(.*?)</\\1>").test(e)}},"./src/js/html.js":
| /*!************************!*\
| !*** ./src/js/html.js ***!
| \************************/
| /*! exports provided: default */function(e,t,n){"use strict";n.r(t);var r=n(/*! ./functions */"./src/js/functions.js"),i=n(/*! ./print */"./src/js/print.js");function o(e){"@babel/helpers - typeof";return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}t.default={print:function(e,t){var n=function(e){return"object"===o(e)&&e&&(e instanceof HTMLElement||1===e.nodeType)}(e.printable)?e.printable:document.getElementById(e.printable);n?(e.printableElement=function e(t,n){var i=t.cloneNode();var o=Array.prototype.slice.call(t.childNodes);for(var a=0;a<o.length;a++)if(-1===n.ignoreElements.indexOf(o[a].id)){var l=e(o[a],n);i.appendChild(l)}n.scanStyles&&1===t.nodeType&&i.setAttribute("style",Object(r.collectStyles)(t,n));switch(t.tagName){case"SELECT":i.value=t.value;break;case"CANVAS":i.getContext("2d").drawImage(t,0,0)}return i}(n,e),e.header&&Object(r.addHeader)(e.printableElement,e),i.default.send(e,t)):window.console.error("Invalid HTML element id: "+e.printable)}}},"./src/js/image.js":
| /*!*************************!*\
| !*** ./src/js/image.js ***!
| \*************************/
| /*! exports provided: default */function(e,t,n){"use strict";n.r(t);var r=n(/*! ./functions */"./src/js/functions.js"),i=n(/*! ./print */"./src/js/print.js"),o=n(/*! ./browser */"./src/js/browser.js");t.default={print:function(e,t){e.printable.constructor!==Array&&(e.printable=[e.printable]),e.printableElement=document.createElement("div"),e.printable.forEach(function(t){var n=document.createElement("img");if(n.setAttribute("style",e.imageStyle),n.src=t,o.default.isFirefox()){var r=n.src;n.src=r}var i=document.createElement("div");i.appendChild(n),e.printableElement.appendChild(i)}),e.header&&Object(r.addHeader)(e.printableElement,e),i.default.send(e,t)}}},"./src/js/init.js":
| /*!************************!*\
| !*** ./src/js/init.js ***!
| \************************/
| /*! exports provided: default */function(e,t,n){"use strict";n.r(t);var r=n(/*! ./browser */"./src/js/browser.js"),i=n(/*! ./modal */"./src/js/modal.js"),o=n(/*! ./pdf */"./src/js/pdf.js"),a=n(/*! ./html */"./src/js/html.js"),l=n(/*! ./raw-html */"./src/js/raw-html.js"),s=n(/*! ./image */"./src/js/image.js"),c=n(/*! ./json */"./src/js/json.js");function u(e){"@babel/helpers - typeof";return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var d=["pdf","html","image","json","raw-html"];t.default={init:function(){var e={printable:null,fallbackPrintable:null,type:"pdf",header:null,headerStyle:"font-weight: 300;",maxWidth:800,properties:null,gridHeaderStyle:"font-weight: bold; padding: 5px; border: 1px solid #dddddd;",gridStyle:"border: 1px solid lightgray; margin-bottom: -1px;",showModal:!1,onError:function(e){throw e},onLoadingStart:null,onLoadingEnd:null,onPrintDialogClose:function(){},onIncompatibleBrowser:function(){},modalMessage:"Retrieving Document...",frameId:"printJS",printableElement:null,documentTitle:"Document",targetStyle:["clear","display","width","min-width","height","min-height","max-height"],targetStyles:["border","box","break","text-decoration"],ignoreElements:[],repeatTableHeader:!0,css:null,style:null,scanStyles:!0,base64:!1,onPdfOpen:null,font:"TimesNewRoman",font_size:"12pt",honorMarginPadding:!0,honorColor:!1,imageStyle:"max-width: 100%;"},t=arguments[0];if(void 0===t)throw new Error("printJS expects at least 1 attribute.");switch(u(t)){case"string":e.printable=encodeURI(t),e.fallbackPrintable=e.printable,e.type=arguments[1]||e.type;break;case"object":for(var n in e.printable=t.printable,e.fallbackPrintable=void 0!==t.fallbackPrintable?t.fallbackPrintable:e.printable,e.fallbackPrintable=e.base64?"data:application/pdf;base64,".concat(e.fallbackPrintable):e.fallbackPrintable,e)"printable"!==n&&"fallbackPrintable"!==n&&(e[n]=void 0!==t[n]?t[n]:e[n]);break;default:throw new Error('Unexpected argument type! Expected "string" or "object", got '+u(t))}if(!e.printable)throw new Error("Missing printable information.");if(!e.type||"string"!=typeof e.type||-1===d.indexOf(e.type.toLowerCase()))throw new Error("Invalid print type. Available types are: pdf, html, image and json.");e.showModal&&i.default.show(e),e.onLoadingStart&&e.onLoadingStart();var f=document.getElementById(e.frameId);f&&f.parentNode.removeChild(f);var p=document.createElement("iframe");switch(r.default.isFirefox()?p.setAttribute("style","width: 1px; height: 100px; position: fixed; left: 0; top: 0; opacity: 0; border-width: 0; margin: 0; padding: 0"):p.setAttribute("style","visibility: hidden; height: 0; width: 0; position: absolute; border: 0"),p.setAttribute("id",e.frameId),"pdf"!==e.type&&(p.srcdoc="<html><head><title>"+e.documentTitle+"</title>",e.css&&(Array.isArray(e.css)||(e.css=[e.css]),e.css.forEach(function(e){p.srcdoc+='<link rel="stylesheet" href="'+e+'">'})),p.srcdoc+="</head><body></body></html>"),e.type){case"pdf":if(r.default.isIE())try{console.info("Print.js doesn't support PDF printing in Internet Explorer."),window.open(e.fallbackPrintable,"_blank").focus(),e.onIncompatibleBrowser()}catch(t){e.onError(t)}finally{e.showModal&&i.default.close(),e.onLoadingEnd&&e.onLoadingEnd()}else o.default.print(e,p);break;case"image":s.default.print(e,p);break;case"html":a.default.print(e,p);break;case"raw-html":l.default.print(e,p);break;case"json":c.default.print(e,p)}}}},"./src/js/json.js":
| /*!************************!*\
| !*** ./src/js/json.js ***!
| \************************/
| /*! exports provided: default */function(e,t,n){"use strict";n.r(t);var r=n(/*! ./functions */"./src/js/functions.js"),i=n(/*! ./print */"./src/js/print.js");function o(e){"@babel/helpers - typeof";return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}t.default={print:function(e,t){if("object"!==o(e.printable))throw new Error("Invalid javascript data object (JSON).");if("boolean"!=typeof e.repeatTableHeader)throw new Error("Invalid value for repeatTableHeader attribute (JSON).");if(!e.properties||!Array.isArray(e.properties))throw new Error("Invalid properties array for your JSON data.");e.properties=e.properties.map(function(t){return{field:"object"===o(t)?t.field:t,displayName:"object"===o(t)?t.displayName:t,columnSize:"object"===o(t)&&t.columnSize?t.columnSize+";":100/e.properties.length+"%;"}}),e.printableElement=document.createElement("div"),e.header&&Object(r.addHeader)(e.printableElement,e),e.printableElement.innerHTML+=function(e){var t=e.printable,n=e.properties,i='<table style="border-collapse: collapse; width: 100%;">';e.repeatTableHeader&&(i+="<thead>");i+="<tr>";for(var o=0;o<n.length;o++)i+='<th style="width:'+n[o].columnSize+";"+e.gridHeaderStyle+'">'+Object(r.capitalizePrint)(n[o].displayName)+"</th>";i+="</tr>",e.repeatTableHeader&&(i+="</thead>");i+="<tbody>";for(var a=0;a<t.length;a++){i+="<tr>";for(var l=0;l<n.length;l++){var s=t[a],c=n[l].field.split(".");if(c.length>1)for(var u=0;u<c.length;u++)s=s[c[u]];else s=s[n[l].field];i+='<td style="width:'+n[l].columnSize+e.gridStyle+'">'+s+"</td>"}i+="</tr>"}return i+="</tbody></table>"}(e),i.default.send(e,t)}}},"./src/js/modal.js":
| /*!*************************!*\
| !*** ./src/js/modal.js ***!
| \*************************/
| /*! exports provided: default */function(e,t,n){"use strict";n.r(t);var r={show:function(e){var t=document.createElement("div");t.setAttribute("style","font-family:sans-serif; display:table; text-align:center; font-weight:300; font-size:30px; left:0; top:0;position:fixed; z-index: 9990;color: #0460B5; width: 100%; height: 100%; background-color:rgba(255,255,255,.9);transition: opacity .3s ease;"),t.setAttribute("id","printJS-Modal");var n=document.createElement("div");n.setAttribute("style","display:table-cell; vertical-align:middle; padding-bottom:100px;");var i=document.createElement("div");i.setAttribute("class","printClose"),i.setAttribute("id","printClose"),n.appendChild(i);var o=document.createElement("span");o.setAttribute("class","printSpinner"),n.appendChild(o);var a=document.createTextNode(e.modalMessage);n.appendChild(a),t.appendChild(n),document.getElementsByTagName("body")[0].appendChild(t),document.getElementById("printClose").addEventListener("click",function(){r.close()})},close:function(){var e=document.getElementById("printJS-Modal");e&&e.parentNode.removeChild(e)}};t.default=r},"./src/js/pdf.js":
| /*!***********************!*\
| !*** ./src/js/pdf.js ***!
| \***********************/
| /*! exports provided: default */function(e,t,n){"use strict";n.r(t);var r=n(/*! ./print */"./src/js/print.js"),i=n(/*! ./functions */"./src/js/functions.js");function o(e,t,n){var i=new window.Blob([n],{type:"application/pdf"});i=window.URL.createObjectURL(i),t.setAttribute("src",i),r.default.send(e,t)}t.default={print:function(e,t){if(e.base64){var n=Uint8Array.from(atob(e.printable),function(e){return e.charCodeAt(0)});o(e,t,n)}else{e.printable=/^(blob|http|\/\/)/i.test(e.printable)?e.printable:window.location.origin+("/"!==e.printable.charAt(0)?"/"+e.printable:e.printable);var r=new window.XMLHttpRequest;r.responseType="arraybuffer",r.addEventListener("error",function(){Object(i.cleanUp)(e),e.onError(r.statusText,r)}),r.addEventListener("load",function(){if(-1===[200,201].indexOf(r.status))return Object(i.cleanUp)(e),void e.onError(r.statusText,r);o(e,t,r.response)}),r.open("GET",e.printable,!0),r.send()}}}},"./src/js/print.js":
| /*!*************************!*\
| !*** ./src/js/print.js ***!
| \*************************/
| /*! exports provided: default */function(e,t,n){"use strict";n.r(t);var r=n(/*! ./browser */"./src/js/browser.js"),i=n(/*! ./functions */"./src/js/functions.js"),o={send:function(e,t){document.getElementsByTagName("body")[0].appendChild(t);var n=document.getElementById(e.frameId);n.onload=function(){if("pdf"!==e.type){var t=n.contentWindow||n.contentDocument;if(t.document&&(t=t.document),t.body.appendChild(e.printableElement),"pdf"!==e.type&&e.style){var i=document.createElement("style");i.innerHTML=e.style,t.head.appendChild(i)}var o=t.getElementsByTagName("img");o.length>0?function(e){var t=e.map(function(e){if(e.src&&e.src!==window.location.href)return function(e){return new Promise(function(t){!function n(){e&&void 0!==e.naturalWidth&&0!==e.naturalWidth&&e.complete?t():setTimeout(n,500)}()})}(e)});return Promise.all(t)}(Array.from(o)).then(function(){return a(n,e)}):a(n,e)}else r.default.isFirefox()?setTimeout(function(){return a(n,e)},1e3):a(n,e)}}};function a(e,t){try{if(e.focus(),r.default.isEdge()||r.default.isIE())try{e.contentWindow.document.execCommand("print",!1,null)}catch(t){e.contentWindow.print()}else e.contentWindow.print()}catch(e){t.onError(e)}finally{r.default.isFirefox()&&(e.style.visibility="hidden",e.style.left="-1px"),Object(i.cleanUp)(t)}}t.default=o},"./src/js/raw-html.js":
| /*!****************************!*\
| !*** ./src/js/raw-html.js ***!
| \****************************/
| /*! exports provided: default */function(e,t,n){"use strict";n.r(t);var r=n(/*! ./print */"./src/js/print.js");t.default={print:function(e,t){e.printableElement=document.createElement("div"),e.printableElement.setAttribute("style","width:100%"),e.printableElement.innerHTML=e.printable,r.default.send(e,t)}}},"./src/sass/index.scss":
| /*!*****************************!*\
| !*** ./src/sass/index.scss ***!
| \*****************************/
| /*! no static exports found */function(e,t,n){},0:
| /*!****************************!*\
| !*** multi ./src/index.js ***!
| \****************************/
| /*! no static exports found */function(e,t,n){e.exports=n(/*! ./src/index.js */"./src/index.js")}}).default})},YReu:function(e,t,n){"use strict";t.__esModule=!0,t.default=function(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}},yZrW:function(e,t,n){var r,i,o;i=[],void 0===(o="function"==typeof(r=function(){"use strict";var e=["|","^"],t=[",",";","\t","|","^"],n=["\r\n","\r","\n"],r=Array.isArray||function(e){return"[object Array]"===toString.call(e)};function i(e){return"string"==typeof e}function o(e,t){return function(e){return null!=e}(e)?e:t}function a(e,t){for(var n=0,r=e.length;n<r&&!1!==t(e[n],n);n+=1);}function l(e){return e.replace(/"/g,'\\"')}function s(e){return"attrs["+e+"]"}function c(e,t){return function(e){return!isNaN(Number(e))}(e)?"Number("+s(t)+")":function(e){return 0==e||1==e}(e)?"Boolean("+s(t)+" == true)":"String("+s(t)+")"}function u(e,t,n,o){var u=[];return 3==arguments.length?(t?r(t)?a(n,function(n,r){i(t[r])?t[r]=t[r].toLowerCase():e[t[r]]=t[r],u.push("deserialize[cast["+r+"]]("+s(r)+")")}):a(n,function(e,t){u.push(c(e,t))}):a(n,function(e,t){u.push(s(t))}),u="return ["+u.join(",")+"]"):(t?r(t)?a(n,function(n,r){i(t[r])?t[r]=t[r].toLowerCase():e[t[r]]=t[r],u.push('"'+l(o[r])+'": deserialize[cast['+r+"]]("+s(r)+")")}):a(n,function(e,t){u.push('"'+l(o[t])+'": '+c(e,t))}):a(n,function(e,t){u.push('"'+l(o[t])+'": '+s(t))}),u="return {"+u.join(",")+"}"),new Function("attrs","deserialize","cast",u)}function d(t,n){var r,i=0;return a(n,function(n){var o,a=n;-1!=e.indexOf(n)&&(a="\\"+a),(o=t.match(new RegExp(a,"g")))&&o.length>i&&(i=o.length,r=n)}),r||n[0]}var f=function(){function e(e,a){if(a||(a={}),r(e))this.mode="encode";else{if(!i(e))throw new Error("Incompatible format!");this.mode="parse"}this.data=e,this.options={header:o(a.header,!1),cast:o(a.cast,!0)};var l=a.lineDelimiter||a.line,s=a.cellDelimiter||a.delimiter;this.isParser()?(this.options.lineDelimiter=l||d(this.data,n),this.options.cellDelimiter=s||d(this.data,t),this.data=function(e,t){return e.slice(-t.length)!=t&&(e+=t),e}(this.data,this.options.lineDelimiter)):this.isEncoder()&&(this.options.lineDelimiter=l||"\r\n",this.options.cellDelimiter=s||",")}function l(e,t,n,r,i){e(new t(n,r,i))}function s(e){return r(e)?"array":function(e){var t=typeof e;return"function"===t||"object"===t&&!!e}(e)?"object":i(e)?"string":function(e){return null==e}(e)?"null":"primitive"}return e.prototype.set=function(e,t){return this.options[e]=t},e.prototype.isParser=function(){return"parse"==this.mode},e.prototype.isEncoder=function(){return"encode"==this.mode},e.prototype.parse=function(e){if("parse"==this.mode){if(0===this.data.trim().length)return[];var t,n,i,o=this.data,a=this.options,s=a.header,c={cell:"",line:[]},d=this.deserialize;e||(i=[],e=function(e){i.push(e)}),1==a.lineDelimiter.length&&(w=v);var f,p,m,b=o.length,h=a.cellDelimiter.charCodeAt(0),y=a.lineDelimiter.charCodeAt(a.lineDelimiter.length-1);for(g(),f=0,p=0;f<b;f++)m=o.charCodeAt(f),t.cell&&(t.cell=!1,34==m)?t.escaped=!0:t.escaped&&34==m?t.quote=!t.quote:(t.escaped&&t.quote||!t.escaped)&&(m==h?(v(c.cell+o.slice(p,f)),p=f+1):m==y&&(w(c.cell+o.slice(p,f)),p=f+1,(c.line.length>1||""!==c.line[0])&&j(),c.line=[]));return i||this}function g(){t={escaped:!1,quote:!1,cell:!0}}function v(e){c.line.push(t.escaped?e.slice(1,-1).replace(/""/g,'"'):e),c.cell="",g()}function w(e){v(e.slice(0,1-a.lineDelimiter.length))}function j(){s?r(s)?(n=u(d,a.cast,c.line,s),(j=function(){l(e,n,c.line,d,a.cast)})()):s=c.line:(n||(n=u(d,a.cast,c.line)),(j=function(){l(e,n,c.line,d,a.cast)})())}},e.prototype.deserialize={string:function(e){return String(e)},number:function(e){return Number(e)},boolean:function(e){return Boolean(e)}},e.prototype.serialize={object:function(e){var t=this,n=Object.keys(e),r=Array(n.length);return a(n,function(n,i){r[i]=t[s(e[n])](e[n])}),r},array:function(e){var t=this,n=Array(e.length);return a(e,function(e,r){n[r]=t[s(e)](e)}),n},string:function(e){return'"'+String(e).replace(/"/g,'""')+'"'},null:function(e){return""},primitive:function(e){return e}},e.prototype.encode=function(e){if("encode"==this.mode){if(0==this.data.length)return"";var t,n,o=this.data,l=this.options,c=l.header,u=o[0],d=this.serialize,f=0;e||(n=Array(o.length),e=function(e,t){n[t+f]=e}),c&&(r(c)||(t=Object.keys(u),c=t),e(b(d.array(c)),0),f=1);var p,m=s(u);return"array"==m?(r(l.cast)?(p=Array(l.cast.length),a(l.cast,function(e,t){i(e)?p[t]=e.toLowerCase():(p[t]=e,d[e]=e)})):(p=Array(u.length),a(u,function(e,t){p[t]=s(e)})),a(o,function(t,n){var r=Array(p.length);a(t,function(e,t){r[t]=d[p[t]](e)}),e(b(r),n)})):"object"==m&&(t=Object.keys(u),r(l.cast)?(p=Array(l.cast.length),a(l.cast,function(e,t){i(e)?p[t]=e.toLowerCase():(p[t]=e,d[e]=e)})):(p=Array(t.length),a(t,function(e,t){p[t]=s(u[e])})),a(o,function(n,r){var i=Array(t.length);a(t,function(e,t){i[t]=d[p[t]](n[e])}),e(b(i),r)})),n?n.join(l.lineDelimiter):this}function b(e){return e.join(l.cellDelimiter)}},e.prototype.forEach=function(e){return this[this.mode](e)},e}();return f.parse=function(e,t){return new f(e,t).parse()},f.encode=function(e,t){return new f(e,t).encode()},f.forEach=function(e,t,n){return 2==arguments.length&&(n=t),new f(e,t).forEach(n)},f})?r.apply(t,i):r)||(e.exports=o)}}]);
|
|