function w(r,n,u=e=>e){const e=Object.create(null);e.options=n||{},e.reviver=u,e.value="",e.entry=[],e.output=[],e.col=1,e.row=1;const i=/"|,|\r\n|\n|\r|[^",\r\n]+/y,c=/^(\r\n|\n|\r)$/;let l=[],t="",a=0;for(;(l=i.exec(r))!==null;)switch(t=l[0],a){case 0:switch(!0){case t==='"':a=3;break;case t===",":a=0,s(e);break;case c.test(t):a=0,s(e),o(e);break;default:e.value+=t,a=2;break}break;case 2:switch(!0){case t===",":a=0,s(e);break;case c.test(t):a=0,s(e),o(e);break;default:throw a=4,Error(`CSVError: Illegal state [row:${e.row}, col:${e.col}]`)}break;case 3:switch(!0){case t==='"':a=4;break;default:a=3,e.value+=t;break}break;case 4:switch(!0){case t==='"':a=3,e.value+=t;break;case t===",":a=0,s(e);break;case c.test(t):a=0,s(e),o(e);break;default:throw Error(`CSVError: Illegal state [row:${e.row}, col:${e.col}]`)}break}return e.entry.length!==0&&(s(e),o(e)),e.output}function s(r){const n=r.options.typed?b(r.value):r.value;r.entry.push(r.reviver(n,r.row,r.col)),r.value="",r.col++}function o(r){r.output.push(r.entry),r.entry=[],r.row++,r.col=1}function b(r){const n=/.\./;switch(!0){case r==="true":case r==="false":return r==="true";case n.test(r):return parseFloat(r);case isFinite(r):return parseInt(r);default:return r}}export{w as p};
