text: !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports.ReactJsonExcel=t(require("react")):e.ReactJsonExcel=t(e.React)}(window,function(e){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=6)}([function(e,t,n){e.exports=n(3)()},function(t,n){t.exports=e},function(e,t,n){(function(t){var n=function(){try{return Function("return this")()||(0,eval)("this")}catch(e){return"object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof t&&t.global===t?t:this}}();function o(e,t,n){var o=new XMLHttpRequest;o.open("GET",e),o.responseType="blob",o.onload=function(){i(o.response,t,n)},o.onerror=function(){console.error("could not download file")},o.send()}function r(e){var t=new XMLHttpRequest;return t.open("HEAD",e,!1),t.send(),t.status>=200&&t.status<=299}function a(e){try{e.dispatchEvent(new MouseEvent("click"))}catch(n){var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var i=n.saveAs||"object"!=typeof window||window!==n?function(){}:"download"in HTMLAnchorElement.prototype?function(e,t,i){var s=n.URL||n.webkitURL,c=document.createElement("a");t=t||e.name||"download",c.download=t,c.rel="noopener","string"==typeof e?(c.href=e,c.origin!==location.origin?r(c.href)?o(e,t,i):a(c,c.target="_blank"):a(c)):(c.href=s.createObjectURL(e),setTimeout(function(){s.revokeObjectURL(c.href)},4e4),setTimeout(function(){a(c)},0))}:"msSaveOrOpenBlob"in navigator?function(e,t,n){if(t=t||e.name||"download","string"==typeof e)if(r(e))o(e,t,n);else{var a=document.createElement("a");a.href=e,a.target="_blank",setTimeout(function(){clikc(a)})}else navigator.msSaveOrOpenBlob(function(e,t){return void 0===t?t={autoBom:!1}:"object"!=typeof t&&(console.warn("Depricated: Expected third argument to be a object"),t={autoBom:!t}),t.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob([String.fromCharCode(65279),e],{type:e.type}):e}(e,n),t)}:function(e,t,r,a){if((a=a||open("","_blank"))&&(a.document.title=a.document.body.innerText="downloading..."),"string"==typeof e)return o(e,t,r);var i="application/octet-stream"===e.type,s=/constructor/i.test(n.HTMLElement)||n.safari,c=/CriOS\/[\d]+/.test(navigator.userAgent);if((c||i&&s)&&"object"==typeof FileReader){var l=new FileReader;l.onloadend=function(){var e=l.result;e=c?e:e.replace(/^data:[^;]*;/,"data:attachment/file;"),a?a.location.href=e:location=e,a=null},l.readAsDataURL(e)}else{var u=n.URL||n.webkitURL,f=u.createObjectURL(e);a?a.location=f:location.href=f,a=null,setTimeout(function(){u.revokeObjectURL(f)},4e4)}};e.exports=n.saveAs=i.saveAs=i}).call(this,n(5))},function(e,t,n){"use strict";var o=n(4);function r(){}e.exports=function(){function e(e,t,n,r,a,i){if(i!==o){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t};return n.checkPropTypes=r,n.PropTypes=n,n}},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";n.r(t);var o=n(1),r=n.n(o),a=n(0),i=n.n(a),s=n(2);function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}class l extends o.Component{constructor(){super(),c(this,"convertToExcel",()=>{const{headers:e}=this.state,{separator:t}=this.props,n=this.getBodyData();return e.join(t)+"\n"+n}),c(this,"getBodyData",()=>{const{data:e,fields:t}=this.state,{separator:n}=this.props;return e.map(e=>t.map(t=>e.hasOwnProperty(t)?e[t]:null).join(n)).join("\n")}),c(this,"saveExcel",()=>{const{fileformat:e,filename:t}=this.props,n=this.convertToExcel(),o=new Blob([n],{type:"text/plain",charset:"utf-8"});Object(s.saveAs)(o,[t+"."+e])}),this.state={data:[],fields:[],headers:[]}}componentDidMount(){const{data:e,fields:t}=this.props;this.setState({data:e,fields:Object.keys(t),headers:Object.keys(t).map(e=>t[e])})}render(){const{className:e,style:t,text:n}=this.props;return r.a.createElement("button",{className:e,onClick:this.saveExcel,style:t},n)}}c(l,"propTypes",{className:i.a.string,data:i.a.array.isRequired,fileformat:i.a.string,filename:i.a.string,fields:i.a.object,separator:i.a.string,style:i.a.object,text:i.a.string}),c(l,"defaultProps",{className:"json-to-excel",fileformat:"csv",filename:"json-to-excel",separator:",",style:{},text:"Convert Json to Excel"});var u=l;n.d(t,"JsonToExcel",function(){return u})}])});