/* Papa Parse v2.1.4 https://github.com/mholt/jquery.parse */ ;(function(e){"use strict";function t(e){return typeof e==="function"}function n(e,t){function f(t){s+=o+t.target.result;o="";if(i-1){o=s.substring(n+1);s=s.substring(0,n)}else{h();return}}var r=u.parse(s);s="";if(i>=e.size)return l(t);else if(r.errors.abort)return;else h()}function l(n){if(typeof t.onComplete==="function")t.onComplete(undefined,e,t.inputElem,n)}function c(){if(typeof t.onFileError==="function")t.onFileError(a.error,e,t.inputElem)}function h(){if(i1){c+=Math.abs(v-a);a=v}}h/=p.results.length;if((typeof o==="undefined"||c1.99){o=c;s=l}}u.delimiter=s;return!!s}function p(){var e=a.i>0&&g(a.i-1)||a.i==0;var t=a.i0){if(E())a.parsed.rows=[{}];else a.parsed.rows.push({})}}else{if(E())a.parsed=[[]];else if(!u.header)a.parsed.push([])}a.lineNum++;a.line="";a.field=0}function w(){if(o)return;y();var e=x();if(!e&&u.header)T();if(E()&&(!u.header||u.header&&a.parsed.rows.length>0)){var t=u.step(C());if(t===false)o=true}}function E(){return typeof u.step==="function"}function S(e){var t=l.floats.test(e);return t?parseFloat(e):e}function x(){if(l.empty.test(a.line)){if(u.header){if(a.lineNum==1){a.parsed.fields=[];a.lineNum--}else a.parsed.rows.splice(a.parsed.rows.length-1,1)}else a.parsed.splice(a.parsed.length-1,1);return true}return false}function T(){if(!u.header)return true;if(a.parsed.rows.length==0)return true;var e=a.parsed.fields.length;var t=0;var n=a.parsed.rows[a.parsed.rows.length-1];for(var r in n)if(n.hasOwnProperty(r))t++;if(te)return N("FieldMismatch","TooManyFields","Too many fields: expected "+e+" fields but parsed "+t);return true}function N(e,t,n,r){var i=u.header?a.parsed.rows.length?a.parsed.rows.length-1:undefined:a.parsed.length-1;var o=r||i;if(typeof a.errors[o]==="undefined")a.errors[o]=[];a.errors[o].push({type:e,code:t,message:n,line:a.lineNum,row:i,index:a.i+s});a.errors.length++;return false}function C(){return{results:a.parsed,errors:a.errors,meta:{delimiter:u.delimiter}}}function k(e){n++;if(n>1&&E())s+=e.length;a=L();i=e}function L(){var e;if(u.header){e={fields:E()?a.parsed.fields||[]:[],rows:E()&&n>1?[{}]:[]}}else e=[[]];return{i:0,lineNum:E()?a.lineNum:1,field:0,fieldVal:"",line:"",ch:"",inQuotes:false,parsed:e,errors:{length:0}}}var t=this;var n=0;var i="";var s=0;var o=false;var u={};var a=L();var f={delimiter:"",header:true,dynamicTyping:true,preview:0};var l={floats:/^\s*-?(\d*\.?\d+|\d+\.?\d*)(e[-+]?\d+)?\s*$/i,empty:/^\s*$/};e=c(e);u={delimiter:e.delimiter,header:e.header,dynamicTyping:e.dynamicTyping,preview:e.preview,step:e.step};this.parse=function(e){if(typeof e!=="string")return C();k(e);if(!u.delimiter&&!h(e)){N("Delimiter","UndetectableDelimiter","Unable to auto-detect delimiting character; defaulted to comma","config");u.delimiter=","}for(a.i=0;a.i0&&a.lineNum>u.preview)break;a.ch=i[a.i];a.line+=a.ch;if(a.ch=='"')p();else if(a.inQuotes)d();else m()}if(o)N("Abort","ParseAbort","Parsing was aborted by the user's step function","abort");else{w();if(a.inQuotes)N("Quotes","MissingQuotes","Unescaped or mismatched quotes")}return C()};this.getOptions=function(){return{delimiter:u.delimiter,header:u.header,dynamicTyping:u.dynamicTyping,preview:u.preview,step:u.step}}}e.fn.parse=function(r){function o(i){var s=a,o;if(t(r.error))o=function(){r.error(c.error,i.file,i.inputElem)};if(t(r.complete))s=function(e,t,n,i){r.complete(e,t,n,i);a()};if(t(r.before)){var f=r.before(i.file,i.inputElem);if(typeof f==="object")i.instanceConfig=e.extend(i.instanceConfig,f);else if(f==="skip")return a();else if(f===false){u("AbortError",i.file,i.inputElem);return}}if(i.instanceConfig.step){var l=new n(i.file,{inputElem:i.inputElem,config:e.extend({},i.instanceConfig)});l.stream(s,o)}else{var c=new FileReader;c.onerror=o;c.onload=function(t){var n=t.target.result;var r=e.parse(n,i.instanceConfig);s(r,i.file,i.inputElem,t)};c.readAsText(i.file,i.instanceConfig.encoding)}}function u(e,n,i){if(t(r.error))r.error({name:e},n,i)}function a(){s.splice(0,1);if(s.length>0)o(s[0])}var i=r.config||{};var s=[];this.each(function(t){var n=e(this).prop("tagName").toUpperCase()=="INPUT"&&e(this).attr("type")=="file"&&window.FileReader;if(!n)return true;var r=e.extend({},i);if(!this.files||this.files.length==0){u("NoFileError",undefined,this);return true}for(var a=0;a0)o(s[0])});return this};e.parse=function(e,t){var n=new r(t);return n.parse(e)}})(jQuery);