diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 0000000..b730813 --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,18 @@ +module.exports = function(grunt) { + grunt.initConfig({ + uglify: { + options: { + preserveComments: 'some', + }, + min: { + files: { + 'papaparse.min.js': ['papaparse.js'] + }, + }, + }, + }); + + grunt.loadNpmTasks('grunt-contrib-uglify'); + + grunt.registerTask('build', ['uglify']); +} diff --git a/package.json b/package.json index 5856b55..ea0b599 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,8 @@ "main": "papaparse.js", "devDependencies": { "connect": "^3.3.3", + "grunt": "^0.4.5", + "grunt-contrib-uglify": "^0.6.0", "open": "0.0.5", "serve-static": "^1.7.1" }, diff --git a/papaparse.js b/papaparse.js index 4ad6c79..e766ada 100644 --- a/papaparse.js +++ b/papaparse.js @@ -1,4 +1,4 @@ -/* +/*! Papa Parse v4.0.7 https://github.com/mholt/PapaParse diff --git a/papaparse.min.js b/papaparse.min.js index 767c0d6..26ca060 100644 --- a/papaparse.min.js +++ b/papaparse.min.js @@ -1,6 +1,6 @@ -/* +/*! Papa Parse v4.0.7 https://github.com/mholt/PapaParse */ -;(function(e){"use strict";function u(r,i){var s=t?i:g(i);var o=s.worker&&Papa.WORKERS_SUPPORTED&&n;if(o){var u=d();u.userStep=s.step;u.userChunk=s.chunk;u.userComplete=s.complete;u.userError=s.error;s.step=b(s.step);s.chunk=b(s.chunk);s.complete=b(s.complete);s.error=b(s.error);delete s.worker;u.postMessage({input:r,config:s,workerId:u.id})}else{if(typeof r==="string"){if(s.download){var a=new f(s);a.stream(r)}else{var h=new c(s);var p=h.parse(r);return p}}else if(e.File&&r instanceof File||r instanceof Object){if(s.step||s.chunk){var a=new l(s);a.stream(r)}else{var h=new c(s);if(t){var v=new FileReaderSync;var m=v.readAsText(r,s.encoding);return h.parse(m)}else{v=new FileReader;v.onload=function(e){var t=new c(s);var n=t.parse(e.target.result)};v.onerror=function(){if(b(s.error))s.error(v.error,r)};v.readAsText(r,s.encoding)}}}}}function a(t,n){function a(){if(typeof n!=="object")return;if(typeof n.delimiter==="string"&&n.delimiter.length==1&&e.Papa.BAD_DELIMITERS.indexOf(n.delimiter)==-1){o=n.delimiter}if(typeof n.quotes==="boolean"||n.quotes instanceof Array)s=n.quotes;if(typeof n.newline==="string")u=n.newline}function f(e){if(typeof e!=="object")return[];var t=[];for(var n in e)t.push(n);return t}function l(e,t){var n="";if(typeof e==="string")e=JSON.parse(e);if(typeof t==="string")t=JSON.parse(t);var r=e instanceof Array&&e.length>0;var i=!(t[0]instanceof Array);if(r){for(var s=0;s0)n+=o;n+=c(e[s],s)}if(t.length>0)n+=u}for(var a=0;a0)n+=o;var h=r&&i?e[l]:l;n+=c(t[a][h],l)}if(a-1||t.charAt(0)==" "||t.charAt(t.length-1)==" ";return r?'"'+t+'"':t}function h(e,t){for(var n=0;n-1)return true;return false}var r="";var i=[];var s=false;var o=",";var u="\r\n";a();if(typeof t==="string")t=JSON.parse(t);if(t instanceof Array){if(!t.length||t[0]instanceof Array)return l(null,t);else if(typeof t[0]==="object")return l(f(t[0]),t)}else if(typeof t==="object"){if(typeof t.data==="string")t.data=JSON.parse(t.data);if(t.data instanceof Array){if(!t.fields)t.fields=t.data[0]instanceof Array?t.fields:f(t.data[0]);if(!(t.data[0]instanceof Array)&&typeof t.data[0]!=="object")t.data=[t.data]}return l(t.fields||[],t.data||[])}throw"exception: Unable to serialize unrecognized input"}function f(n){function m(){if(h){g();return}a=new XMLHttpRequest;if(!t){a.onload=g;a.onerror=w}a.open("GET",f,!t);if(n.step||n.chunk){var e=r+v.chunkSize-1;if(i&&e>i)e=i;a.setRequestHeader("Range","bytes="+r+"-"+e)}try{a.send()}catch(s){w(s.message)}if(t&&a.status==0)w();else r+=v.chunkSize}function g(){if(a.readyState!=4)return;if(a.status<200||a.status>=400){w();return}o+=u+a.responseText;u="";h=!n.step&&!n.chunk||r>E(a);if(!h){var i=o.lastIndexOf("\r");if(i==-1)i=o.lastIndexOf("\n");if(i!=-1){u=o.substring(i+1);o=o.substring(0,i)}else{l();return}}var f=d.parse(o);o="";if(f&&f.data)s+=f.data.length;var c=h||v.preview&&s>=v.preview;if(t){e.postMessage({results:f,workerId:Papa.WORKER_ID,finished:c})}else if(b(n.chunk)){n.chunk(f,d);f=undefined}if(b(p)&&c)p(f);if(!c&&(!f||!f.meta.paused))l()}function w(r){var i=a.statusText||r;if(b(n.error))n.error(i);else if(t&&n.error){e.postMessage({workerId:Papa.WORKER_ID,error:i,finished:false})}}function E(e){var t=e.getResponseHeader("Content-Range");return parseInt(t.substr(t.lastIndexOf("/")+1))}function S(e){v=y(e);p=v.complete;v.complete=undefined;v.chunkSize=parseInt(v.chunkSize);d=new c(v);d.streamer=this}n=n||{};if(!n.chunkSize)n.chunkSize=Papa.RemoteChunkSize;var r=0,i=0,s=0;var o="";var u="";var a,f,l,h;var p,d,v;S(n);this.resume=function(){paused=false;l()};this.finished=function(){return h};this.pause=function(){paused=true};this.abort=function(){h=true;if(b(p))p({data:[],errors:[],meta:{aborted:true}})};this.stream=function(e){f=e;if(t){l=function(){m();g()}}else{l=function(){m()}}l()}}function l(n){function p(){if(!d&&(!g.preview||a=i.size;if(!d){var c=o.lastIndexOf("\r");if(c==-1)c=o.lastIndexOf("\n");if(c!=-1){u=o.substring(c+1);o=o.substring(0,c)}else{p();return}}var h=m.parse(o);o="";if(h&&h.data)a+=h.data.length;var y=d||g.preview&&a>=g.preview;if(t){e.postMessage({results:h,workerId:Papa.WORKER_ID,finished:y})}else if(b(n.chunk)){n.chunk(h,l,i);if(f)return;h=undefined}if(b(v)&&y)v(h);if(!y&&(!h||!h.meta.paused))p()}function x(){if(b(n.error))n.error(h.error,i);else if(t&&n.error){e.postMessage({workerId:Papa.WORKER_ID,error:h.error,file:i,finished:false})}}function T(e){g=y(e);v=g.complete;g.complete=undefined;g.chunkSize=parseInt(g.chunkSize);m=new c(g);m.streamer=this}n=n||{};if(!n.chunkSize)n.chunkSize=Papa.LocalChunkSize;var r=0;var i;var s;var o="";var u="";var a=0;var f=false;var l=this;var h,p,s,d;var v,m,g;T(n);var w=typeof FileReader!=="undefined";this.stream=function(e){i=e;s=i.slice||i.webkitSlice||i.mozSlice;if(w){h=new FileReader;h.onload=S;h.onerror=x}else h=new FileReaderSync;p()};this.finished=function(){return d};this.pause=function(){f=true};this.resume=function(){f=false;p()};this.abort=function(){d=true;if(b(v))v({data:[],errors:[],meta:{aborted:true}})}}function c(e){function c(){if(f&&u){E("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+Papa.DefaultDelimiter+"'");u=false}if(e.skipEmptyLines){for(var t=0;t=a.length){if(!n["__parsed_extra"])n["__parsed_extra"]=[];n["__parsed_extra"].push(f.data[t][r])}else n[a[r]]=f.data[t][r]}}if(e.header){f.data[t]=n;if(r>a.length)E("FieldMismatch","TooManyFields","Too many fields: expected "+a.length+" fields but parsed "+r,t);else if(r1){a+=Math.abs(p-s);s=p}}f/=l.data.length;if((typeof i==="undefined"||a1.99){i=a;r=u}}e.delimiter=r;return{successful:!!r,bestDelimiter:r}}function g(e){e=e.substr(0,1024*1024);var t=e.split("\r");if(t.length==1)return"\n";var n=0;for(var r=0;r=t.length/2?"\r\n":"\r"}function w(e){var n=t.test(e);return n?parseFloat(e):e}function E(e,t,n,r){f.errors.push({type:e,code:t,message:n,row:r})}var t=/^\s*-?(\d*\.?\d+|\d+\.?\d*)(e[-+]?\d+)?\s*$/i;var n=this;var r=0;var i;var s;var o=false;var u;var a=[];var f={data:[],errors:[],meta:{}};if(b(e.step)){var l=e.step;e.step=function(t){f=t;if(p())c();else{c();if(f.data.length==0)return;r+=t.data.length;if(e.preview&&r>e.preview)s.abort();else l(f,n)}}}this.parse=function(t){if(!e.newline)e.newline=g(t);u=false;if(!e.delimiter){var r=m(t);if(r.successful)e.delimiter=r.bestDelimiter;else{u=true;e.delimiter=Papa.DefaultDelimiter}f.meta.delimiter=e.delimiter}var a=y(e);if(e.preview&&e.header)a.preview++;i=t;s=new h(a);f=s.parse(i);c();if(b(e.complete)&&!o&&(!n.streamer||n.streamer.finished()))e.complete(f);return o?{meta:{paused:true}}:f||{meta:{paused:false}}};this.pause=function(){o=true;s.abort();i=i.substr(s.getCharIndex())};this.resume=function(){o=false;s=new h(e);s.parse(i);if(!o){if(n.streamer&&!n.streamer.finished())n.streamer.resume();else if(b(e.complete))e.complete(f)}};this.abort=function(){s.abort();if(b(e.complete))e.complete(f);i=""}}function h(e){e=e||{};var t=e.delimiter;var n=e.newline;var r=e.comments;var i=e.step;var s=e.preview;var o=e.fastMode;if(typeof t!=="string"||t.length!=1||Papa.BAD_DELIMITERS.indexOf(t)>-1)t=",";if(r===t)throw"Comment character same as delimiter";else if(r===true)r="#";else if(typeof r!=="string"||Papa.BAD_DELIMITERS.indexOf(r)>-1)r=false;if(n!="\n"&&n!="\r"&&n!="\r\n")n="\n";var u=0;var a=false;this.parse=function(e){function S(){m.push(e.substr(u));d.push(m);u=f;if(p)N();return T()}function x(t){d.push(m);m=[];u=t;w=e.indexOf(n,u)}function T(e){return{data:d,errors:v,meta:{delimiter:t,linebreak:n,aborted:a,truncated:!!e}}}function N(){i(T());d=[],v=[]}if(typeof e!=="string")throw"Input must be a string";var f=e.length,l=t.length,c=n.length,h=r.length;var p=typeof i==="function";u=0;var d=[],v=[],m=[];if(!e)return T();if(o){var g=e.split(n);for(var y=0;y=s){d=d.slice(0,s);return T(true)}}return T()}var b=e.indexOf(t,u);var w=e.indexOf(n,u);for(;;){if(e[u]=='"'){var E=u;u++;for(;;){var E=e.indexOf('"',E+1);if(E==-1){v.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:d.length,index:u});return S()}if(E==f-1){m.push(e.substring(u,E).replace(/""/g,'"'));d.push(m);if(p)N();return T()}if(e[E+1]=='"'){E++;continue}if(e[E+1]==t){m.push(e.substring(u,E).replace(/""/g,'"'));u=E+1+l;b=e.indexOf(t,u);w=e.indexOf(n,u);break}if(e.substr(E+1,c)==n){m.push(e.substring(u,E).replace(/""/g,'"'));x(E+1+c);b=e.indexOf(t,u);if(p){N();if(a)return T()}if(s&&d.length>=s)return T(true);break}}continue}if(r&&m.length==0&&e.substr(u,h)==r){if(w==-1)return T();u=w+c;w=e.indexOf(n,u);b=e.indexOf(t,u);continue}if(b!=-1&&(b=s)return T(true);continue}break}return S()};this.abort=function(){a=true};this.getCharIndex=function(){return u}}function p(){var e="worker"+String(Math.random()).substr(2);document.write('');return document.getElementById(e).previousSibling.src}function d(){if(!Papa.WORKERS_SUPPORTED)return false;var t=new e.Worker(n);t.onmessage=v;t.id=i++;r[t.id]=t;return t}function v(e){var t=e.data;var n=r[t.workerId];if(t.error)n.userError(t.error,t.file);else if(t.results&&t.results.data){if(b(n.userStep)){for(var i=0;i-1)t.delimiter=s.delimiter;if(t.newline!="\n"&&t.newline!="\r"&&t.newline!="\r\n")t.newline=s.newline;if(typeof t.header!=="boolean")t.header=s.header;if(typeof t.dynamicTyping!=="boolean")t.dynamicTyping=s.dynamicTyping;if(typeof t.preview!=="number")t.preview=s.preview;if(typeof t.step!=="function")t.step=s.step;if(typeof t.complete!=="function")t.complete=s.complete;if(typeof t.error!=="function")t.error=s.error;if(typeof t.encoding!=="string")t.encoding=s.encoding;if(typeof t.worker!=="boolean")t.worker=s.worker;if(typeof t.download!=="boolean")t.download=s.download;if(typeof t.skipEmptyLines!=="boolean")t.skipEmptyLines=s.skipEmptyLines;if(typeof t.fastMode!=="boolean")t.fastMode=s.fastMode;return t}function y(e){if(typeof e!=="object")return e;var t=e instanceof Array?[]:{};for(var n in e)t[n]=y(e[n]);return t}function b(e){return typeof e==="function"}var t=!e.document,n;var r={},i=0;var s={delimiter:"",newline:"",header:false,dynamicTyping:false,preview:0,step:undefined,encoding:"",worker:false,comments:false,complete:undefined,error:undefined,download:false,chunk:undefined,skipEmptyLines:false,fastMode:false};e.Papa={};e.Papa.parse=u;e.Papa.unparse=a;e.Papa.RECORD_SEP=String.fromCharCode(30);e.Papa.UNIT_SEP=String.fromCharCode(31);e.Papa.BYTE_ORDER_MARK="";e.Papa.BAD_DELIMITERS=["\r","\n",'"',e.Papa.BYTE_ORDER_MARK];e.Papa.WORKERS_SUPPORTED=!!e.Worker;e.Papa.LocalChunkSize=1024*1024*10;e.Papa.RemoteChunkSize=1024*1024*5;e.Papa.DefaultDelimiter=",";e.Papa.Parser=h;e.Papa.ParserHandle=c;e.Papa.NetworkStreamer=f;e.Papa.FileStreamer=l;if(e.jQuery){var o=e.jQuery;o.fn.parse=function(t){function i(){if(r.length==0){if(b(t.complete))t.complete();return}var e=r[0];if(b(t.before)){var n=t.before(e.file,e.inputElem);if(typeof n==="object"){if(n.action=="abort"){s("AbortError",e.file,e.inputElem,n.reason);return}else if(n.action=="skip"){u();return}else if(typeof n.config==="object")e.instanceConfig=o.extend(e.instanceConfig,n.config)}else if(n=="skip"){u();return}}var i=e.instanceConfig.complete;e.instanceConfig.complete=function(t){if(b(i))i(t,e.file,e.inputElem);u()};Papa.parse(e.file,e.instanceConfig)}function s(e,n,r,i){if(b(t.error))t.error({name:e},n,r,i)}function u(){r.splice(0,1);i()}var n=t.config||{};var r=[];this.each(function(t){var i=o(this).prop("tagName").toUpperCase()=="INPUT"&&o(this).attr("type").toLowerCase()=="file"&&e.FileReader;if(!i||!this.files||this.files.length==0)return true;for(var s=0;s0,e=!(b[0]instanceof Array);if(d){for(var f=0;f0&&(c+=j),c+=g(a[f],f);b.length>0&&(c+=k)}for(var h=0;hl;l++){l>0&&(c+=j);var m=d&&e?a[l]:l;c+=g(b[h][m],l)}h-1||" "==b.charAt(0)||" "==b.charAt(b.length-1);return d?'"'+b+'"':b}function h(a,b){for(var c=0;c-1)return!0;return!1}var i=!1,j=",",k="\r\n";if(d(),"string"==typeof b&&(b=JSON.parse(b)),b instanceof Array){if(!b.length||b[0]instanceof Array)return f(null,b);if("object"==typeof b[0])return f(e(b[0]),b)}else if("object"==typeof b)return"string"==typeof b.data&&(b.data=JSON.parse(b.data)),b.data instanceof Array&&(b.fields||(b.fields=b.data[0]instanceof Array?b.fields:e(b.data[0])),b.data[0]instanceof Array||"object"==typeof b.data[0]||(b.data=[b.data])),f(b.fields||[],b.data||[]);throw"exception: Unable to serialize unrecognized input"}function d(b){function c(){if(l)return void d();if(i=new XMLHttpRequest,p||(i.onload=d,i.onerror=e),i.open("GET",j,!p),b.step||b.chunk){var a=s+r.chunkSize-1;t&&a>t&&(a=t),i.setRequestHeader("Range","bytes="+s+"-"+a)}try{i.send()}catch(c){e(c.message)}p&&0==i.status?e():s+=r.chunkSize}function d(){if(4==i.readyState){if(i.status<200||i.status>=400)return void e();if(v+=w+i.responseText,w="",l=!b.step&&!b.chunk||s>g(i),!l){var c=v.lastIndexOf("\r");if(-1==c&&(c=v.lastIndexOf("\n")),-1==c)return void k();w=v.substring(c+1),v=v.substring(0,c)}var d=q.parse(v);v="",d&&d.data&&(u+=d.data.length);var f=l||r.preview&&u>=r.preview;p?a.postMessage({results:d,workerId:Papa.WORKER_ID,finished:f}):n(b.chunk)&&(b.chunk(d,q),d=void 0),n(o)&&f&&o(d),f||d&&d.meta.paused||k()}}function e(c){var d=i.statusText||c;n(b.error)?b.error(d):p&&b.error&&a.postMessage({workerId:Papa.WORKER_ID,error:d,finished:!1})}function g(a){var b=a.getResponseHeader("Content-Range");return parseInt(b.substr(b.lastIndexOf("/")+1))}function h(a){r=m(a),o=r.complete,r.complete=void 0,r.chunkSize=parseInt(r.chunkSize),q=new f(r),q.streamer=this}b=b||{},b.chunkSize||(b.chunkSize=Papa.RemoteChunkSize);var i,j,k,l,o,q,r,s=0,t=0,u=0,v="",w="";h(b),this.resume=function(){paused=!1,k()},this.finished=function(){return l},this.pause=function(){paused=!0},this.abort=function(){l=!0,n(o)&&o({data:[],errors:[],meta:{aborted:!0}})},this.stream=function(a){j=a,(k=p?function(){c(),d()}:function(){c()})()}}function e(b){function c(){l||r.preview&&!(v=i.size,!l){var e=t.lastIndexOf("\r");if(-1==e&&(e=t.lastIndexOf("\n")),-1==e)return void c();u=t.substring(e+1),t=t.substring(0,e)}var f=q.parse(t);t="",f&&f.data&&(v+=f.data.length);var g=l||r.preview&&v>=r.preview;if(p)a.postMessage({results:f,workerId:Papa.WORKER_ID,finished:g});else if(n(b.chunk)){if(b.chunk(f,x,i),w)return;f=void 0}n(o)&&g&&o(f),g||f&&f.meta.paused||c()}function g(){n(b.error)?b.error(k.error,i):p&&b.error&&a.postMessage({workerId:Papa.WORKER_ID,error:k.error,file:i,finished:!1})}function h(a){r=m(a),o=r.complete,r.complete=void 0,r.chunkSize=parseInt(r.chunkSize),q=new f(r),q.streamer=this}b=b||{},b.chunkSize||(b.chunkSize=Papa.LocalChunkSize);var i,j,k,c,j,l,o,q,r,s=0,t="",u="",v=0,w=!1,x=this;h(b);var y="undefined"!=typeof FileReader;this.stream=function(a){i=a,j=i.slice||i.webkitSlice||i.mozSlice,y?(k=new FileReader,k.onload=e,k.onerror=g):k=new FileReaderSync,c()},this.finished=function(){return l},this.pause=function(){w=!0},this.resume=function(){w=!1,c()},this.abort=function(){l=!0,n(o)&&o({data:[],errors:[],meta:{aborted:!0}})}}function f(a){function b(){if(u&&o&&(j("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to '"+Papa.DefaultDelimiter+"'"),o=!1),a.skipEmptyLines)for(var b=0;b=t.length?(c.__parsed_extra||(c.__parsed_extra=[]),c.__parsed_extra.push(u.data[b][d])):c[t[d]]=u.data[b][d])}a.header&&(u.data[b]=c,d>t.length?j("FieldMismatch","TooManyFields","Too many fields: expected "+t.length+" fields but parsed "+d,b):d1&&(j+=Math.abs(n-e),e=n):e=n}k/=l.data.length,("undefined"==typeof d||d>j)&&k>1.99&&(d=j,c=i)}return a.delimiter=c,{successful:!!c,bestDelimiter:c}}function h(a){a=a.substr(0,1048576);var b=a.split("\r");if(1==b.length)return"\n";for(var c=0,d=0;d=b.length/2?"\r\n":"\r"}function i(a){var b=p.test(a);return b?parseFloat(a):a}function j(a,b,c,d){u.errors.push({type:a,code:b,message:c,row:d})}var k,l,o,p=/^\s*-?(\d*\.?\d+|\d+\.?\d*)(e[-+]?\d+)?\s*$/i,q=this,r=0,s=!1,t=[],u={data:[],errors:[],meta:{}};if(n(a.step)){var v=a.step;a.step=function(d){if(u=d,c())b();else{if(b(),0==u.data.length)return;r+=d.data.length,a.preview&&r>a.preview?l.abort():v(u,q)}}}this.parse=function(c){if(a.newline||(a.newline=h(c)),o=!1,!a.delimiter){var d=f(c);d.successful?a.delimiter=d.bestDelimiter:(o=!0,a.delimiter=Papa.DefaultDelimiter),u.meta.delimiter=a.delimiter}var e=m(a);return a.preview&&a.header&&e.preview++,k=c,l=new g(e),u=l.parse(k),b(),!n(a.complete)||s||q.streamer&&!q.streamer.finished()||a.complete(u),s?{meta:{paused:!0}}:u||{meta:{paused:!1}}},this.pause=function(){s=!0,l.abort(),k=k.substr(l.getCharIndex())},this.resume=function(){s=!1,l=new g(a),l.parse(k),s||(q.streamer&&!q.streamer.finished()?q.streamer.resume():n(a.complete)&&a.complete(u))},this.abort=function(){l.abort(),n(a.complete)&&a.complete(u),k=""}}function g(a){a=a||{};var b=a.delimiter,c=a.newline,d=a.comments,e=a.step,f=a.preview,g=a.fastMode;if(("string"!=typeof b||1!=b.length||Papa.BAD_DELIMITERS.indexOf(b)>-1)&&(b=","),d===b)throw"Comment character same as delimiter";d===!0?d="#":("string"!=typeof d||Papa.BAD_DELIMITERS.indexOf(d)>-1)&&(d=!1),"\n"!=c&&"\r"!=c&&"\r\n"!=c&&(c="\n");var h=0,i=!1;this.parse=function(a){function j(){return u.push(a.substr(h)),s.push(u),h=n,r&&m(),l()}function k(b){s.push(u),u=[],h=b,y=a.indexOf(c,h)}function l(a){return{data:s,errors:t,meta:{delimiter:b,linebreak:c,aborted:i,truncated:!!a}}}function m(){e(l()),s=[],t=[]}if("string"!=typeof a)throw"Input must be a string";var n=a.length,o=b.length,p=c.length,q=d.length,r="function"==typeof e;h=0;var s=[],t=[],u=[];if(!a)return l();if(g){for(var v=a.split(c),w=0;w=f)return s=s.slice(0,f),l(!0)}return l()}for(var x=a.indexOf(b,h),y=a.indexOf(c,h);;)if('"'!=a[h])if(d&&0===u.length&&a.substr(h,q)===d){if(-1==y)return l();h=y+p,y=a.indexOf(c,h),x=a.indexOf(b,h)}else if(-1!==x&&(y>x||-1===y))u.push(a.substring(h,x)),h=x+o,x=a.indexOf(b,h);else{if(-1===y)break;if(u.push(a.substring(h,y)),k(y+p),r&&(m(),i))return l();if(f&&s.length>=f)return l(!0)}else{var z=h;for(h++;;){var z=a.indexOf('"',z+1);if(-1===z)return t.push({type:"Quotes",code:"MissingQuotes",message:"Quoted field unterminated",row:s.length,index:h}),j();if(z===n-1)return u.push(a.substring(h,z).replace(/""/g,'"')),s.push(u),r&&m(),l();if('"'!=a[z+1]){if(a[z+1]==b){u.push(a.substring(h,z).replace(/""/g,'"')),h=z+1+o,x=a.indexOf(b,h),y=a.indexOf(c,h);break}if(a.substr(z+1,p)===c){if(u.push(a.substring(h,z).replace(/""/g,'"')),k(z+1+p),x=a.indexOf(b,h),r&&(m(),i))return l();if(f&&s.length>=f)return l(!0);break}}else z++}}return j()},this.abort=function(){i=!0},this.getCharIndex=function(){return h}}function h(){var a="worker"+String(Math.random()).substr(2);return document.write(''),document.getElementById(a).previousSibling.src}function i(){if(!Papa.WORKERS_SUPPORTED)return!1;var b=new a.Worker(o);return b.onmessage=j,b.id=r++,q[b.id]=b,b}function j(a){var b=a.data,c=q[b.workerId];if(b.error)c.userError(b.error,b.file);else if(b.results&&b.results.data)if(n(c.userStep)){for(var d=0;d-1)&&(b.delimiter=s.delimiter),"\n"!=b.newline&&"\r"!=b.newline&&"\r\n"!=b.newline&&(b.newline=s.newline),"boolean"!=typeof b.header&&(b.header=s.header),"boolean"!=typeof b.dynamicTyping&&(b.dynamicTyping=s.dynamicTyping),"number"!=typeof b.preview&&(b.preview=s.preview),"function"!=typeof b.step&&(b.step=s.step),"function"!=typeof b.complete&&(b.complete=s.complete),"function"!=typeof b.error&&(b.error=s.error),"string"!=typeof b.encoding&&(b.encoding=s.encoding),"boolean"!=typeof b.worker&&(b.worker=s.worker),"boolean"!=typeof b.download&&(b.download=s.download),"boolean"!=typeof b.skipEmptyLines&&(b.skipEmptyLines=s.skipEmptyLines),"boolean"!=typeof b.fastMode&&(b.fastMode=s.fastMode),b}function m(a){if("object"!=typeof a)return a;var b=a instanceof Array?[]:{};for(var c in a)b[c]=m(a[c]);return b}function n(a){return"function"==typeof a}var o,p=!a.document,q={},r=0,s={delimiter:"",newline:"",header:!1,dynamicTyping:!1,preview:0,step:void 0,encoding:"",worker:!1,comments:!1,complete:void 0,error:void 0,download:!1,chunk:void 0,skipEmptyLines:!1,fastMode:!1};if(a.Papa={},a.Papa.parse=b,a.Papa.unparse=c,a.Papa.RECORD_SEP=String.fromCharCode(30),a.Papa.UNIT_SEP=String.fromCharCode(31),a.Papa.BYTE_ORDER_MARK="",a.Papa.BAD_DELIMITERS=["\r","\n",'"',a.Papa.BYTE_ORDER_MARK],a.Papa.WORKERS_SUPPORTED=!!a.Worker,a.Papa.LocalChunkSize=10485760,a.Papa.RemoteChunkSize=5242880,a.Papa.DefaultDelimiter=",",a.Papa.Parser=g,a.Papa.ParserHandle=f,a.Papa.NetworkStreamer=d,a.Papa.FileStreamer=e,a.jQuery){var t=a.jQuery;t.fn.parse=function(b){function c(){if(0==g.length)return void(n(b.complete)&&b.complete());var a=g[0];if(n(b.before)){var c=b.before(a.file,a.inputElem);if("object"==typeof c){if("abort"==c.action)return void d("AbortError",a.file,a.inputElem,c.reason);if("skip"==c.action)return void e();"object"==typeof c.config&&(a.instanceConfig=t.extend(a.instanceConfig,c.config))}else if("skip"==c)return void e()}var f=a.instanceConfig.complete;a.instanceConfig.complete=function(b){n(f)&&f(b,a.file,a.inputElem),e()},Papa.parse(a.file,a.instanceConfig)}function d(a,c,d,e){n(b.error)&&b.error({name:a},c,d,e)}function e(){g.splice(0,1),c()}var f=b.config||{},g=[];return this.each(function(){var b="INPUT"==t(this).prop("tagName").toUpperCase()&&"file"==t(this).attr("type").toLowerCase()&&a.FileReader;if(!b||!this.files||0==this.files.length)return!0;for(var c=0;c