var F={},d={},E=34,g=10,U=13;function O(r){return new Function("d","return {"+r.map(function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'}).join(",")+"}")}function L(r,t){var e=O(r);return function(c,a){return t(e(c),a,r)}}function I(r){var t=Object.create(null),e=[];return r.forEach(function(c){for(var a in c)a in t||e.push(t[a]=a)}),e}function f(r,t){var e=r+"",c=e.length;return c<t?new Array(t-c+1).join(0)+e:e}function S(r){return r<0?"-"+f(-r,6):r>9999?"+"+f(r,6):f(r,4)}function Z(r){var t=r.getUTCHours(),e=r.getUTCMinutes(),c=r.getUTCSeconds(),a=r.getUTCMilliseconds();return isNaN(r)?"Invalid Date":S(r.getUTCFullYear())+"-"+f(r.getUTCMonth()+1,2)+"-"+f(r.getUTCDate(),2)+(a?"T"+f(t,2)+":"+f(e,2)+":"+f(c,2)+"."+f(a,3)+"Z":c?"T"+f(t,2)+":"+f(e,2)+":"+f(c,2)+"Z":e||t?"T"+f(t,2)+":"+f(e,2)+"Z":"")}function B(r){var t=new RegExp('["'+r+`
\r]`),e=r.charCodeAt(0);function c(n,o){var s,u,i=a(n,function(h,l){if(s)return s(h,l-1);u=h,s=o?L(h,o):O(h)});return i.columns=u||[],i}function a(n,o){var s=[],u=n.length,i=0,h=0,l,A=u<=0,C=!1;n.charCodeAt(u-1)===g&&--u,n.charCodeAt(u-1)===U&&--u;function D(){if(A)return d;if(C)return C=!1,F;var m,v=i,p;if(n.charCodeAt(v)===E){for(;i++<u&&n.charCodeAt(i)!==E||n.charCodeAt(++i)===E;);return(m=i)>=u?A=!0:(p=n.charCodeAt(i++))===g?C=!0:p===U&&(C=!0,n.charCodeAt(i)===g&&++i),n.slice(v+1,m-1).replace(/""/g,'"')}for(;i<u;){if((p=n.charCodeAt(m=i++))===g)C=!0;else if(p===U)C=!0,n.charCodeAt(i)===g&&++i;else if(p!==e)continue;return n.slice(v,m)}return A=!0,n.slice(v,u)}for(;(l=D())!==d;){for(var j=[];l!==F&&l!==d;)j.push(l),l=D();o&&(j=o(j,h++))==null||s.push(j)}return s}function N(n,o){return n.map(function(s){return o.map(function(u){return T(s[u])}).join(r)})}function M(n,o){return o==null&&(o=I(n)),[o.map(T).join(r)].concat(N(n,o)).join(`
`)}function b(n,o){return o==null&&(o=I(n)),N(n,o).join(`
`)}function w(n){return n.map(R).join(`
`)}function R(n){return n.map(T).join(r)}function T(n){return n==null?"":n instanceof Date?Z(n):t.test(n+="")?'"'+n.replace(/"/g,'""')+'"':n}return{parse:c,parseRows:a,format:M,formatBody:b,formatRows:w,formatRow:R,formatValue:T}}export{B as d};
