'use strict'; var utilExtractor = require('@flatfile/util-extractor'); var remeda = require('remeda'); var y = require('xml-json-format'); function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; } var y__default = /*#__PURE__*/_interopDefault(y); function i(r,e){let t=e?.transform||(s=>s),n=g(r.toString()),o=m(n);return {["Sheet1"]:{headers:o,data:n.map(s=>remeda.mapValues(t(s),u=>({value:u})))}}}function g(r){return l(y__default.default(r)).map(t=>c(t))}function m(r){let e={};return r.forEach(t=>{Object.keys(t).forEach(n=>{e[n]=!0;});}),Object.keys(e)}function d(r){if(r&&"_attributes"in r){let e=p(r._attributes,(t,n)=>[`#${t}`,n]);return delete r._attributes,{...r,...e}}return r}function p(r,e){let t={};return Object.keys(r).forEach(n=>{let[o,a]=e(n,r[n]);t[o]=a;}),t}function c(r,e=""){let t=d(r);if(!t)return {};let n={};return Object.keys(t).forEach(o=>{let a=e?e+(o.startsWith("#")||o==="_text"?"":"/"):"";typeof t[o]=="object"?Object.assign(n,c(t[o],a+o)):n[a+(o==="_text"&&a?"":o)]=t[o];}),n}function l(r){let e=Object.keys(r).find(t=>t!=="_declaration");if(!e)throw new Error("No root xml object found");return Array.isArray(r[e])?r[e]:[r[e]]}var A=r=>utilExtractor.Extractor(".xml","xml",i,r),E=i; exports.XMLExtractor = A; exports.xmlParser = E; //# sourceMappingURL=index.cjs.map //# sourceMappingURL=index.cjs.map