data-restructor 3.4.5 → 3.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/.github/workflows/codeql-analysis.yml +1 -1
  2. package/.github/workflows/continuous-integration.yaml +6 -6
  3. package/.nvmrc +1 -1
  4. package/CHANGELOG.md +150 -1
  5. package/coverage/coverage-summary.json +4 -4
  6. package/coverage/datarestructor.js.html +1 -1
  7. package/coverage/describedfield.js.html +1 -1
  8. package/coverage/index.html +6 -6
  9. package/coverage/templateResolver.js.html +7 -16
  10. package/devdist/datarestructor-global-all.js +3 -6
  11. package/devdist/datarestructor-ie-global-all.js +3 -6
  12. package/devdist/datarestructor-ie.js +3 -6
  13. package/devdist/datarestructor.js +3 -6
  14. package/devdist/templateResolver-ie.js +3 -6
  15. package/devdist/templateResolver.js +3 -6
  16. package/dist/datarestructor-global-all-min.js +1 -1
  17. package/dist/datarestructor-ie-global-all-min.js +1 -1
  18. package/dist/datarestructor-ie.js +1 -1
  19. package/dist/datarestructor-ie.js.map +1 -1
  20. package/dist/datarestructor.js +1 -1
  21. package/dist/datarestructor.js.map +1 -1
  22. package/dist/templateResolver-ie.js +1 -1
  23. package/dist/templateResolver-ie.js.map +1 -1
  24. package/dist/templateResolver.js +1 -1
  25. package/dist/templateResolver.js.map +1 -1
  26. package/docs/datarestructor.js.html +1 -1
  27. package/docs/describedfield.js.html +1 -1
  28. package/docs/index.html +1 -1
  29. package/docs/module-datarestructor.DescribedEntryCreator.html +1 -1
  30. package/docs/module-datarestructor.PropertyStructureDescriptionBuilder.html +1 -1
  31. package/docs/module-datarestructor.Restructor.html +1 -1
  32. package/docs/module-datarestructor.Transform.html +1 -1
  33. package/docs/module-datarestructor.html +1 -1
  34. package/docs/module-described_field.DescribedDataFieldBuilder.html +1 -1
  35. package/docs/module-described_field.DescribedDataFieldGroup.html +1 -1
  36. package/docs/module-described_field.html +1 -1
  37. package/docs/module-template_resolver.Resolver.html +4 -4
  38. package/docs/module-template_resolver.html +1 -1
  39. package/docs/templateResolver.js.html +4 -7
  40. package/package.json +8 -8
  41. package/src/js/templateResolver.js +3 -6
@@ -1 +1 @@
1
- var module=module||{},require=require||function(){};Array.prototype.filter||(Array.prototype.filter=function(e,t){"use strict";if("Function"!=typeof e&&"function"!=typeof e||!this)throw new TypeError;var r,i=this.length>>>0,n=new Array(i),o=this,a=0,s=-1;if(void 0===t)for(;++s!==i;)s in this&&(r=o[s],e(o[s],s,o)&&(n[a++]=r));else for(;++s!==i;)s in this&&(r=o[s],e.call(t,o[s],s,o)&&(n[a++]=r));return n.length=a,n}),Array.prototype.indexOf||(Array.prototype.indexOf=function(e,t,r){"use strict";return function(i,n){if(null==this)throw TypeError("Array.prototype.indexOf called on null or undefined");var o=e(this),a=o.length>>>0,s=r(0|n,a);if(s<0)s=t(0,a+s);else if(s>=a)return-1;if(void 0===i){for(;s!==a;++s)if(void 0===o[s]&&s in o)return s}else if(i!=i){for(;s!==a;++s)if(o[s]!=o[s])return s}else for(;s!==a;++s)if(o[s]===i)return s;return-1}}(Object,Math.max,Math.min)),Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),Object.keys||(Object.keys=function(e){if(e!==Object(e))throw new TypeError("Object.keys called on a non-object");var t,r=[];for(t in e)Object.prototype.hasOwnProperty.call(e,t)&&r.push(t);return r});"use strict";(internal_object_tools=(module=module||{}).exports={}).flattenToArray=function(e,t){var r=[];return("number"!=typeof t||t<1)&&(t=20),function e(i,n,o){if(!(o>t||"function"==typeof i))if(Object(i)!==i)r.push({name:n,value:i});else if(Array.isArray(i)){var a,s=i.length;for(a=0;a<s;a+=1)e(i[a],n+"["+a+"]",o+1);0===s&&(r[n]=[],r.push({name:n,value:""}))}else{var u,l=!0;for(u in i)l=!1,e(i[u],n?n+"."+u:u,o+1);l&&n&&r.push({name:n,value:""})}}(e,"",0),r};module=templateResolverInternalCreateIfNotExists(module);function templateResolverInternalCreateIfNotExists(e){return e||{}}(template_resolver=module.exports={}).internalCreateIfNotExists=templateResolverInternalCreateIfNotExists;var internal_object_tools=internal_object_tools||require("../../lib/js/flattenToArray");template_resolver.Resolver=function(){var e=new RegExp("\\[\\d+\\]","gi");function t(t){var r=t.lastIndexOf("."),i=t;r>0&&(i=t.substr(r+1));var n="";return r>0&&(n=t.substr(0,r+1)),{group:n,groupWithoutArrayIndices:n.replace(e,""),name:i}}function r(e,t,r){var i,n;for(i=0;i<e.length;i+=1)n=e[i],"function"==typeof r&&r(n.name)&&(t[n.name]=n.value);return t}return function(e){this.sourceDataObject=e,this.resolveTemplate=function(e){return this.replaceResolvableFields(e,function(e){var r,i,n,o,a=Object.keys(e);for(r=0;r<a.length;r+=1)i=a[r],o=e[i],"fieldName"===(n=t(i)).name&&"fieldName"!==o&&(e[n.groupWithoutArrayIndices+o]=e[n.group+"value"]);return e}(this.resolvableFieldsOfAll(this.sourceDataObject)))},this.resolvableFieldsOfAll=function(){var e,t={},i=function(e){return 0!==e.indexOf("_")&&e.indexOf("._")<0};for(e=0;e<arguments.length;e+=1)r(internal_object_tools.flattenToArray(arguments[e],3),t,i);return t},this.replaceResolvableFields=function(e,t){var r=e,i=Object.keys(t),n=0,o="",a="";for(n=0;n<i.length;n+=1)a=t[o=i[n]],r=r.replace("{{"+o+"}}",a);return r}}}();module=describedFieldInternalCreateIfNotExists(module);function describedFieldInternalCreateIfNotExists(e){return e||{}}function datarestructorInternalCreateIfNotExists(e){return e||{}}(described_field=module.exports={}).internalCreateIfNotExists=describedFieldInternalCreateIfNotExists,described_field.DescribedDataFieldBuilder=function(){function e(e,t){return function(e){return"string"==typeof e&&null!==e&&""!==e}(e)?e:t}function t(e,t){return null==e?t:e}return function(){this.describedField={category:"",type:"",abbreviation:"",image:"",index:[],groupNames:[],displayName:"",fieldName:"",value:""},this.fromDescribedDataField=function(e){return this.category(e.category),this.type(e.type),this.abbreviation(e.abbreviation),this.image(e.image),this.index(e.index),this.groupNames(e.groupNames),this.displayName(e.displayName),this.fieldName(e.fieldName),this.value(e.value),this},this.category=function(t){return this.describedField.category=e(t,""),this},this.type=function(t){return this.describedField.type=e(t,""),this},this.abbreviation=function(t){return this.describedField.abbreviation=e(t,""),this},this.image=function(t){return this.describedField.image=e(t,""),this},this.index=function(e){return this.describedField.index=t(e,[]),this},this.groupNames=function(e){return this.describedField.groupNames=t(e,[]),this},this.displayName=function(t){return this.describedField.displayName=e(t,""),this},this.fieldName=function(t){return this.describedField.fieldName=e(t,""),this},this.value=function(e){return this.describedField.value=e,this},this.build=function(){return this.describedField}}}(),described_field.copyWithoutGroups=function(e){return(new described_field.DescribedDataFieldBuilder).fromDescribedDataField(e).groupNames([]).build()},described_field.DescribedDataFieldGroup=function(){return function(e){this.dataField=e,this.addGroupEntry=function(e,t){return this.addGroupEntries(e,[t]),this},this.addGroupEntries=function(e,t){if(!e||0===e.length)return this;if(!t||0===t.length)return this;var r,i;for(void 0===this.dataField[e]&&(this.dataField.groupNames.push(e),this.dataField[e]=[]),r=0;r<t.length;r+=1)i=t[r],this.dataField[e].push(i);return this}}}();var datarestructor=(module=datarestructorInternalCreateIfNotExists(module)).exports={};datarestructor.internalCreateIfNotExists=datarestructorInternalCreateIfNotExists;internal_object_tools=internal_object_tools||require("../../lib/js/flattenToArray");var template_resolver=template_resolver||require("../../src/js/templateResolver"),described_field=described_field||require("../../src/js/describedfield");datarestructor.PropertyStructureDescriptionBuilder=function(){function e(e,i){if(o(e))return function(){return e};if(i.propertyPatternTemplateMode){var n=i.propertyPattern;return a=n,function(e){var i=r(a,"{{fieldName}}"),n=i.exec(e);return n&&""!=n[1]?n[1]:t(e)}}var a;return function(e){return t(e)}}function t(e){var t=new RegExp("(\\w+)$","gi"),r=e.match(t);return null!=r?r[0]:e}function r(e,t){var r=i(e);return"string"==typeof t&&(t=i(t)),r="^"+(r=r.replace(t,"([-\\w]+)")),new RegExp(r,"i")}function i(e){var t=new RegExp("([^-\\w])","gi");return e.replace(t,"\\$1")}function n(e,t){return o(e)?e:t}function o(e){return"string"==typeof e&&null!=e&&""!=e}return function(){this.description={type:"",category:"",abbreviation:"",image:"",propertyPatternTemplateMode:!1,propertyPattern:"",indexStartsWith:"",groupName:"group",groupPattern:"",groupDestinationPattern:"",groupDestinationName:null,deduplicationPattern:"",getDisplayNameForPropertyName:null,getFieldNameForPropertyName:null,matchesPropertyName:null},this.type=function(e){return this.description.type=n(e,""),this},this.category=function(e){return this.description.category=n(e,""),this},this.abbreviation=function(e){return this.description.abbreviation=n(e,""),this},this.image=function(e){return this.description.image=n(e,""),this},this.propertyPatternEqualMode=function(){return this.description.propertyPatternTemplateMode=!1,this},this.propertyPatternTemplateMode=function(){return this.description.propertyPatternTemplateMode=!0,this},this.propertyPattern=function(e){return this.description.propertyPattern=n(e,""),this},this.indexStartsWith=function(e){return this.description.indexStartsWith=n(e,""),this},this.displayPropertyName=function(t){return this.description.getDisplayNameForPropertyName=e(t,this.description),o(t)?this:(this.description.getDisplayNameForPropertyName=(r=this.description.getDisplayNameForPropertyName,function(e){var t=r(e);return(t=null!=t?t:"").replace("_comma_separated_values","")}),this.description.getDisplayNameForPropertyName=function(e){return function(t){return(r=e(t)).length>1?r.charAt(0).toUpperCase()+r.slice(1):r;var r}}(this.description.getDisplayNameForPropertyName),this);var r},this.fieldName=function(t){return this.description.getFieldNameForPropertyName=e(t,this.description),this},this.groupName=function(e){return this.description.groupName=n(e,""),this},this.groupPattern=function(e){return this.description.groupPattern=n(e,""),this},this.groupDestinationPattern=function(e){return this.description.groupDestinationPattern=n(e,""),this},this.groupDestinationName=function(e){return this.description.groupDestinationName=n(e,this.description.groupName),this},this.deduplicationPattern=function(e){return this.description.deduplicationPattern=n(e,""),this},this.build=function(){return this.description.matchesPropertyName=(e=this.description,o(t=e.propertyPattern)?e.propertyPatternTemplateMode?function(e){return null!=(i=t,n=new RegExp("\\\\\\{\\\\\\{[-\\w]+\\\\\\}\\\\\\}","gi"),r(i,n)).exec(e);var i,n}:function(e){return e===t}:function(){return!1}),null==this.description.getDisplayNameForPropertyName&&this.displayPropertyName(""),null==this.description.getFieldNameForPropertyName&&this.fieldName(""),null==this.description.groupDestinationName&&this.groupDestinationName(""),this.description;var e,t}}}(),datarestructor.DescribedEntryCreator=function(){var e=new RegExp("\\[\\d+\\]","gi");return function(t,r){var i,n,o=(i=t.name,n=new RegExp("\\[(\\d+)\\]","gi"),function(e,t){var r,i="",n=[];do{(r=t.exec(e))&&(i.length>0&&(i+="."),i+=r[1],n.push(parseInt(r[1])))}while(r);return{pointDelimited:i,numberArray:n}}(i,n)),a=t.name.replace(e,""),s=new template_resolver.Resolver(this);this.category=r.category,this.type=r.type,this.abbreviation=r.abbreviation,this.image=r.image,this.index=o.numberArray,this.displayName=r.getDisplayNameForPropertyName(a),this.fieldName=r.getFieldNameForPropertyName(a),this.value=t.value,this.groupNames=[],this._isMatchingIndex=0==o.pointDelimited.indexOf(r.indexStartsWith),this._description=r,this._identifier={index:o.pointDelimited,propertyNameWithArrayIndices:t.name,propertyNameWithoutArrayIndices:a,groupId:"",groupDestinationId:"",deduplicationId:""},this._identifier.groupId=s.replaceResolvableFields(r.groupPattern,s.resolvableFieldsOfAll(this,this._description,this._identifier)),this._identifier.groupDestinationId=s.replaceResolvableFields(r.groupDestinationPattern,s.resolvableFieldsOfAll(this,this._description,this._identifier)),this._identifier.deduplicationId=s.replaceResolvableFields(r.deduplicationPattern,s.resolvableFieldsOfAll(this,this._description,this._identifier)),this.addGroupEntry=function(e,t){this.addGroupEntries(e,[t])},this.addGroupEntries=function(e,t){var r,i;for(this[e]||(this.groupNames.push(e),this[e]=[]),r=0;r<t.length;r+=1)i=t[r],this[e].push(i)}}}(),datarestructor.Transform=function(){function e(e,t,r){var i,n,o,a=function(e,t){for(var r=new Object,i=0;i<e.length;i++){var n=e[i];r[t(n)]=n}return r}(t,r),s=[];for(i=0;i<e.length;i+=1)null!=(o=r(n=e[i]))&&""!==o&&null!=a[o]||s.push(n);for(i=0;i<t.length;i+=1)n=t[i],s.push(n);return s}function t(t,r){if(null==t||0==t.length)return r;return e(t,r,function(e){return e._identifier.deduplicationId})}function r(e,t){var r=new RegExp("\\[\\d+\\]","gi"),i=[];return e.filter(function(e){var n=e.name.replace(r,"");if(t.matchesPropertyName(n)){var o=new datarestructor.DescribedEntryCreator(e,t);o._isMatchingIndex&&i.push(o)}}),i}function i(e,t){var r=(new described_field.DescribedDataFieldBuilder).category(e.category).type(e.type).abbreviation(e.abbreviation).image(e.image).index(e.index).displayName(e.displayName).fieldName(e.fieldName).value(e.value).build();if(t.recursionDepth>t.config.maxRecursionDepth)return r;var o=null,a="",s=new described_field.DescribedDataFieldGroup(r);return function(e,t){var r,i,n,o;for(r=0;r<e.groupNames.length;r+=1)for(n=e.groupNames[r],i=0;i<e[n].length;i+=1)o=e[n][i],t(n,o,e[n])}(e,function(e,r,u){t.groupToSkip!==e?(a="",t.recursionDepth>=t.config.removeDuplicationAboveRecursionDepth&&(a=function(e,t,r){if(e===t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;for(var i=0;i<e.length;++i)if(!r(e[i],t[i]))return!1;return!0}(r[e],u,n)?e:""),o={recursionDepth:t.recursionDepth+1,config:t.config,groupToSkip:a},s.addGroupEntry(e,i(r,o))):t.config.debugMode&&console.log("Removed duplicate group "+e+" at recursion depth "+t.recursionDepth)}),r}function n(e,t){return o(e.category)===o(t.category)&&o(e.type)===o(t.type)&&e.fieldName===t.fieldName&&e.value===t.value}function o(e){return function(e,t){if(void 0===e||!e)return t;return e}(e,"")}return function(e){this.descriptions=e,this.config={debugMode:!1,maxRecursionDepth:8,removeDuplicationAboveRecursionDepth:1},this.enableDebugMode=function(){return this.config.debugMode=!0,this},this.setMaxRecursionDepth=function(e){if("number"!=typeof e||e<0)throw"Invalid max recursion depth value: "+e;return this.config.maxRecursionDepth=e,this},this.setRemoveDuplicationAboveRecursionDepth=function(e){if("number"!=typeof e||e<0)throw"Invalid remove duplications above recursion depth value: "+e;return this.config.removeDuplicationAboveRecursionDepth=e,this},this.processJson=function(e){return function(e,n,o){var a,s,u,l,d,c=internal_object_tools.flattenToArray(e);a=c,s=new RegExp("\\[\\d+\\]$","gi"),u=[],l="",d="",a.filter(function(e){if(!e.name.match(s))return""!==l&&(u.push({name:l+"_comma_separated_values",value:d}),l=""),void u.push(e);var t=e.name.replace(s,"");l===t?d+=", "+e.value:(""!==l&&(u.push({name:l+"_comma_separated_values",value:d}),l=""),l=t,d=e.value),u.push(e)}),c=u,o.debugMode&&(console.log("flattened data with array values:"),console.log(c));var p,h,f,g=[];for(p=0;p<n.length;p+=1)h=n[p],f=r(c,h),g=t(g,f);return c=g,o.debugMode&&(console.log("describedData data:"),console.log(c)),c=function(e){return function(e,t,r){for(var i=new Object,n=0;n<e.length;n++){var o=e[n],a=t(o);if(""!==a){var s=r(o);null!=s&&""!==s&&(i[a]||(i[a]=o),i[a].addGroupEntry(s,o))}}return i}(e,function(e){return e._identifier.groupId},function(e){return e._description.groupName})}(c),o.debugMode&&(console.log("grouped describedData data:"),console.log(c)),c=function(e){for(var t=Object.keys(e),r=[],i=0;i<t.length;i++){var n=t[i],o=e[n];if(""!=o._description.groupDestinationPattern){var a=o._identifier.groupDestinationId;if(null!=e[a]){var s=o[o._description.groupName];e[a].addGroupEntries(o._description.groupDestinationName,s),r.push(n)}}}for(i=0;i<r.length;i+=1){var u=r[i];delete e[u]}return e}(c),o.debugMode&&(console.log("moved grouped describedData data:"),console.log(c)),c=function(e,t){var r,n,o=[];for(r=0;r<e.length;r+=1)n=e[r],o.push(i(n,{recursionDepth:0,config:t,groupToSkip:""}));return o}(c=function(e){for(var t=[],r=Object.keys(e),i=0;i<r.length;i++){var n=r[i],o=e[n];t.push(o)}return t}(c),o),o.debugMode&&(console.log("transformed result:"),console.log(c)),c}(e,this.descriptions,this.config)}}}(),datarestructor.Restructor={},datarestructor.Restructor.processJsonUsingDescriptions=function(e,t,r){var i=new datarestructor.Transform(t);return r&&i.enableDebugMode(),i.processJson(e)};
1
+ var module=module||{},require=require||function(){};Array.prototype.filter||(Array.prototype.filter=function(e,t){"use strict";if("Function"!=typeof e&&"function"!=typeof e||!this)throw new TypeError;var r,i=this.length>>>0,n=new Array(i),o=this,a=0,s=-1;if(void 0===t)for(;++s!==i;)s in this&&(r=o[s],e(o[s],s,o)&&(n[a++]=r));else for(;++s!==i;)s in this&&(r=o[s],e.call(t,o[s],s,o)&&(n[a++]=r));return n.length=a,n}),Array.prototype.indexOf||(Array.prototype.indexOf=function(e,t,r){"use strict";return function(i,n){if(null==this)throw TypeError("Array.prototype.indexOf called on null or undefined");var o=e(this),a=o.length>>>0,s=r(0|n,a);if(s<0)s=t(0,a+s);else if(s>=a)return-1;if(void 0===i){for(;s!==a;++s)if(void 0===o[s]&&s in o)return s}else if(i!=i){for(;s!==a;++s)if(o[s]!=o[s])return s}else for(;s!==a;++s)if(o[s]===i)return s;return-1}}(Object,Math.max,Math.min)),Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),Object.keys||(Object.keys=function(e){if(e!==Object(e))throw new TypeError("Object.keys called on a non-object");var t,r=[];for(t in e)Object.prototype.hasOwnProperty.call(e,t)&&r.push(t);return r});"use strict";(internal_object_tools=(module=module||{}).exports={}).flattenToArray=function(e,t){var r=[];return("number"!=typeof t||t<1)&&(t=20),function e(i,n,o){if(!(o>t||"function"==typeof i))if(Object(i)!==i)r.push({name:n,value:i});else if(Array.isArray(i)){var a,s=i.length;for(a=0;a<s;a+=1)e(i[a],n+"["+a+"]",o+1);0===s&&(r[n]=[],r.push({name:n,value:""}))}else{var u,l=!0;for(u in i)l=!1,e(i[u],n?n+"."+u:u,o+1);l&&n&&r.push({name:n,value:""})}}(e,"",0),r};module=templateResolverInternalCreateIfNotExists(module);function templateResolverInternalCreateIfNotExists(e){return e||{}}(template_resolver=module.exports={}).internalCreateIfNotExists=templateResolverInternalCreateIfNotExists;var internal_object_tools=internal_object_tools||require("../../lib/js/flattenToArray");template_resolver.Resolver=function(){var e=new RegExp("\\[\\d+\\]","gi");function t(t){var r=t.lastIndexOf("."),i=t;r>0&&(i=t.substr(r+1));var n="";return r>0&&(n=t.substr(0,r+1)),{group:n,groupWithoutArrayIndices:n.replace(e,""),name:i}}function r(e,t,r){var i,n;for(i=0;i<e.length;i+=1)n=e[i],"function"==typeof r&&r(n.name)&&(t[n.name]=n.value);return t}return function(e){this.sourceDataObject=e,this.resolveTemplate=function(e){return this.replaceResolvableFields(e,function(e){var r,i,n,o,a=Object.keys(e);for(r=0;r<a.length;r+=1)i=a[r],o=e[i],"fieldName"===(n=t(i)).name&&"fieldName"!==o&&(e[n.groupWithoutArrayIndices+o]=e[n.group+"value"]);return e}(this.resolvableFieldsOfAll(this.sourceDataObject)))},this.resolvableFieldsOfAll=function(){var e,t={},i=function(e){return 0!==e.indexOf("_")&&e.indexOf("._")<0};for(e=0;e<arguments.length;e+=1)r(internal_object_tools.flattenToArray(arguments[e],3),t,i);return t},this.replaceResolvableFields=function(e,t){for(var r=e,i=Object.keys(t),n=0;n<i.length;n+=1){var o=i[n],a=t[o];r=r.replace("{{"+o+"}}",a)}return r}}}();module=describedFieldInternalCreateIfNotExists(module);function describedFieldInternalCreateIfNotExists(e){return e||{}}function datarestructorInternalCreateIfNotExists(e){return e||{}}(described_field=module.exports={}).internalCreateIfNotExists=describedFieldInternalCreateIfNotExists,described_field.DescribedDataFieldBuilder=function(){function e(e,t){return function(e){return"string"==typeof e&&null!==e&&""!==e}(e)?e:t}function t(e,t){return null==e?t:e}return function(){this.describedField={category:"",type:"",abbreviation:"",image:"",index:[],groupNames:[],displayName:"",fieldName:"",value:""},this.fromDescribedDataField=function(e){return this.category(e.category),this.type(e.type),this.abbreviation(e.abbreviation),this.image(e.image),this.index(e.index),this.groupNames(e.groupNames),this.displayName(e.displayName),this.fieldName(e.fieldName),this.value(e.value),this},this.category=function(t){return this.describedField.category=e(t,""),this},this.type=function(t){return this.describedField.type=e(t,""),this},this.abbreviation=function(t){return this.describedField.abbreviation=e(t,""),this},this.image=function(t){return this.describedField.image=e(t,""),this},this.index=function(e){return this.describedField.index=t(e,[]),this},this.groupNames=function(e){return this.describedField.groupNames=t(e,[]),this},this.displayName=function(t){return this.describedField.displayName=e(t,""),this},this.fieldName=function(t){return this.describedField.fieldName=e(t,""),this},this.value=function(e){return this.describedField.value=e,this},this.build=function(){return this.describedField}}}(),described_field.copyWithoutGroups=function(e){return(new described_field.DescribedDataFieldBuilder).fromDescribedDataField(e).groupNames([]).build()},described_field.DescribedDataFieldGroup=function(){return function(e){this.dataField=e,this.addGroupEntry=function(e,t){return this.addGroupEntries(e,[t]),this},this.addGroupEntries=function(e,t){if(!e||0===e.length)return this;if(!t||0===t.length)return this;var r,i;for(void 0===this.dataField[e]&&(this.dataField.groupNames.push(e),this.dataField[e]=[]),r=0;r<t.length;r+=1)i=t[r],this.dataField[e].push(i);return this}}}();var datarestructor=(module=datarestructorInternalCreateIfNotExists(module)).exports={};datarestructor.internalCreateIfNotExists=datarestructorInternalCreateIfNotExists;internal_object_tools=internal_object_tools||require("../../lib/js/flattenToArray");var template_resolver=template_resolver||require("../../src/js/templateResolver"),described_field=described_field||require("../../src/js/describedfield");datarestructor.PropertyStructureDescriptionBuilder=function(){function e(e,i){if(o(e))return function(){return e};if(i.propertyPatternTemplateMode){var n=i.propertyPattern;return a=n,function(e){var i=r(a,"{{fieldName}}"),n=i.exec(e);return n&&""!=n[1]?n[1]:t(e)}}var a;return function(e){return t(e)}}function t(e){var t=new RegExp("(\\w+)$","gi"),r=e.match(t);return null!=r?r[0]:e}function r(e,t){var r=i(e);return"string"==typeof t&&(t=i(t)),r="^"+(r=r.replace(t,"([-\\w]+)")),new RegExp(r,"i")}function i(e){var t=new RegExp("([^-\\w])","gi");return e.replace(t,"\\$1")}function n(e,t){return o(e)?e:t}function o(e){return"string"==typeof e&&null!=e&&""!=e}return function(){this.description={type:"",category:"",abbreviation:"",image:"",propertyPatternTemplateMode:!1,propertyPattern:"",indexStartsWith:"",groupName:"group",groupPattern:"",groupDestinationPattern:"",groupDestinationName:null,deduplicationPattern:"",getDisplayNameForPropertyName:null,getFieldNameForPropertyName:null,matchesPropertyName:null},this.type=function(e){return this.description.type=n(e,""),this},this.category=function(e){return this.description.category=n(e,""),this},this.abbreviation=function(e){return this.description.abbreviation=n(e,""),this},this.image=function(e){return this.description.image=n(e,""),this},this.propertyPatternEqualMode=function(){return this.description.propertyPatternTemplateMode=!1,this},this.propertyPatternTemplateMode=function(){return this.description.propertyPatternTemplateMode=!0,this},this.propertyPattern=function(e){return this.description.propertyPattern=n(e,""),this},this.indexStartsWith=function(e){return this.description.indexStartsWith=n(e,""),this},this.displayPropertyName=function(t){return this.description.getDisplayNameForPropertyName=e(t,this.description),o(t)?this:(this.description.getDisplayNameForPropertyName=(r=this.description.getDisplayNameForPropertyName,function(e){var t=r(e);return(t=null!=t?t:"").replace("_comma_separated_values","")}),this.description.getDisplayNameForPropertyName=function(e){return function(t){return(r=e(t)).length>1?r.charAt(0).toUpperCase()+r.slice(1):r;var r}}(this.description.getDisplayNameForPropertyName),this);var r},this.fieldName=function(t){return this.description.getFieldNameForPropertyName=e(t,this.description),this},this.groupName=function(e){return this.description.groupName=n(e,""),this},this.groupPattern=function(e){return this.description.groupPattern=n(e,""),this},this.groupDestinationPattern=function(e){return this.description.groupDestinationPattern=n(e,""),this},this.groupDestinationName=function(e){return this.description.groupDestinationName=n(e,this.description.groupName),this},this.deduplicationPattern=function(e){return this.description.deduplicationPattern=n(e,""),this},this.build=function(){return this.description.matchesPropertyName=(e=this.description,o(t=e.propertyPattern)?e.propertyPatternTemplateMode?function(e){return null!=(i=t,n=new RegExp("\\\\\\{\\\\\\{[-\\w]+\\\\\\}\\\\\\}","gi"),r(i,n)).exec(e);var i,n}:function(e){return e===t}:function(){return!1}),null==this.description.getDisplayNameForPropertyName&&this.displayPropertyName(""),null==this.description.getFieldNameForPropertyName&&this.fieldName(""),null==this.description.groupDestinationName&&this.groupDestinationName(""),this.description;var e,t}}}(),datarestructor.DescribedEntryCreator=function(){var e=new RegExp("\\[\\d+\\]","gi");return function(t,r){var i,n,o=(i=t.name,n=new RegExp("\\[(\\d+)\\]","gi"),function(e,t){var r,i="",n=[];do{(r=t.exec(e))&&(i.length>0&&(i+="."),i+=r[1],n.push(parseInt(r[1])))}while(r);return{pointDelimited:i,numberArray:n}}(i,n)),a=t.name.replace(e,""),s=new template_resolver.Resolver(this);this.category=r.category,this.type=r.type,this.abbreviation=r.abbreviation,this.image=r.image,this.index=o.numberArray,this.displayName=r.getDisplayNameForPropertyName(a),this.fieldName=r.getFieldNameForPropertyName(a),this.value=t.value,this.groupNames=[],this._isMatchingIndex=0==o.pointDelimited.indexOf(r.indexStartsWith),this._description=r,this._identifier={index:o.pointDelimited,propertyNameWithArrayIndices:t.name,propertyNameWithoutArrayIndices:a,groupId:"",groupDestinationId:"",deduplicationId:""},this._identifier.groupId=s.replaceResolvableFields(r.groupPattern,s.resolvableFieldsOfAll(this,this._description,this._identifier)),this._identifier.groupDestinationId=s.replaceResolvableFields(r.groupDestinationPattern,s.resolvableFieldsOfAll(this,this._description,this._identifier)),this._identifier.deduplicationId=s.replaceResolvableFields(r.deduplicationPattern,s.resolvableFieldsOfAll(this,this._description,this._identifier)),this.addGroupEntry=function(e,t){this.addGroupEntries(e,[t])},this.addGroupEntries=function(e,t){var r,i;for(this[e]||(this.groupNames.push(e),this[e]=[]),r=0;r<t.length;r+=1)i=t[r],this[e].push(i)}}}(),datarestructor.Transform=function(){function e(e,t,r){var i,n,o,a=function(e,t){for(var r=new Object,i=0;i<e.length;i++){var n=e[i];r[t(n)]=n}return r}(t,r),s=[];for(i=0;i<e.length;i+=1)null!=(o=r(n=e[i]))&&""!==o&&null!=a[o]||s.push(n);for(i=0;i<t.length;i+=1)n=t[i],s.push(n);return s}function t(t,r){if(null==t||0==t.length)return r;return e(t,r,function(e){return e._identifier.deduplicationId})}function r(e,t){var r=new RegExp("\\[\\d+\\]","gi"),i=[];return e.filter(function(e){var n=e.name.replace(r,"");if(t.matchesPropertyName(n)){var o=new datarestructor.DescribedEntryCreator(e,t);o._isMatchingIndex&&i.push(o)}}),i}function i(e,t){var r=(new described_field.DescribedDataFieldBuilder).category(e.category).type(e.type).abbreviation(e.abbreviation).image(e.image).index(e.index).displayName(e.displayName).fieldName(e.fieldName).value(e.value).build();if(t.recursionDepth>t.config.maxRecursionDepth)return r;var o=null,a="",s=new described_field.DescribedDataFieldGroup(r);return function(e,t){var r,i,n,o;for(r=0;r<e.groupNames.length;r+=1)for(n=e.groupNames[r],i=0;i<e[n].length;i+=1)o=e[n][i],t(n,o,e[n])}(e,function(e,r,u){t.groupToSkip!==e?(a="",t.recursionDepth>=t.config.removeDuplicationAboveRecursionDepth&&(a=function(e,t,r){if(e===t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;for(var i=0;i<e.length;++i)if(!r(e[i],t[i]))return!1;return!0}(r[e],u,n)?e:""),o={recursionDepth:t.recursionDepth+1,config:t.config,groupToSkip:a},s.addGroupEntry(e,i(r,o))):t.config.debugMode&&console.log("Removed duplicate group "+e+" at recursion depth "+t.recursionDepth)}),r}function n(e,t){return o(e.category)===o(t.category)&&o(e.type)===o(t.type)&&e.fieldName===t.fieldName&&e.value===t.value}function o(e){return function(e,t){if(void 0===e||!e)return t;return e}(e,"")}return function(e){this.descriptions=e,this.config={debugMode:!1,maxRecursionDepth:8,removeDuplicationAboveRecursionDepth:1},this.enableDebugMode=function(){return this.config.debugMode=!0,this},this.setMaxRecursionDepth=function(e){if("number"!=typeof e||e<0)throw"Invalid max recursion depth value: "+e;return this.config.maxRecursionDepth=e,this},this.setRemoveDuplicationAboveRecursionDepth=function(e){if("number"!=typeof e||e<0)throw"Invalid remove duplications above recursion depth value: "+e;return this.config.removeDuplicationAboveRecursionDepth=e,this},this.processJson=function(e){return function(e,n,o){var a,s,u,l,d,c=internal_object_tools.flattenToArray(e);a=c,s=new RegExp("\\[\\d+\\]$","gi"),u=[],l="",d="",a.filter(function(e){if(!e.name.match(s))return""!==l&&(u.push({name:l+"_comma_separated_values",value:d}),l=""),void u.push(e);var t=e.name.replace(s,"");l===t?d+=", "+e.value:(""!==l&&(u.push({name:l+"_comma_separated_values",value:d}),l=""),l=t,d=e.value),u.push(e)}),c=u,o.debugMode&&(console.log("flattened data with array values:"),console.log(c));var p,h,f,g=[];for(p=0;p<n.length;p+=1)h=n[p],f=r(c,h),g=t(g,f);return c=g,o.debugMode&&(console.log("describedData data:"),console.log(c)),c=function(e){return function(e,t,r){for(var i=new Object,n=0;n<e.length;n++){var o=e[n],a=t(o);if(""!==a){var s=r(o);null!=s&&""!==s&&(i[a]||(i[a]=o),i[a].addGroupEntry(s,o))}}return i}(e,function(e){return e._identifier.groupId},function(e){return e._description.groupName})}(c),o.debugMode&&(console.log("grouped describedData data:"),console.log(c)),c=function(e){for(var t=Object.keys(e),r=[],i=0;i<t.length;i++){var n=t[i],o=e[n];if(""!=o._description.groupDestinationPattern){var a=o._identifier.groupDestinationId;if(null!=e[a]){var s=o[o._description.groupName];e[a].addGroupEntries(o._description.groupDestinationName,s),r.push(n)}}}for(i=0;i<r.length;i+=1){var u=r[i];delete e[u]}return e}(c),o.debugMode&&(console.log("moved grouped describedData data:"),console.log(c)),c=function(e,t){var r,n,o=[];for(r=0;r<e.length;r+=1)n=e[r],o.push(i(n,{recursionDepth:0,config:t,groupToSkip:""}));return o}(c=function(e){for(var t=[],r=Object.keys(e),i=0;i<r.length;i++){var n=r[i],o=e[n];t.push(o)}return t}(c),o),o.debugMode&&(console.log("transformed result:"),console.log(c)),c}(e,this.descriptions,this.config)}}}(),datarestructor.Restructor={},datarestructor.Restructor.processJsonUsingDescriptions=function(e,t,r){var i=new datarestructor.Transform(t);return r&&i.enableDebugMode(),i.processJson(e)};
@@ -1,2 +1,2 @@
1
- var $parcel$global=globalThis,$parcel$modules={},$parcel$inits={},parcelRequire=$parcel$global.parcelRequirec1f2;null==parcelRequire&&((parcelRequire=function(e){if(e in $parcel$modules)return $parcel$modules[e].exports;if(e in $parcel$inits){var t=$parcel$inits[e];delete $parcel$inits[e];var r={id:e,exports:{}};return $parcel$modules[e]=r,t.call(r.exports,r,r.exports),r.exports}var i=Error("Cannot find module '"+e+"'");throw i.code="MODULE_NOT_FOUND",i}).register=function(e,t){$parcel$inits[e]=t},$parcel$global.parcelRequirec1f2=parcelRequire);"use strict";var parcelRegister=parcelRequire.register;parcelRegister("dED0n",function(e,t){var r,i,n;Array.prototype.indexOf||(Array.prototype.indexOf=(r=Object,i=Math.max,n=Math.min,function(e,t){if(this===null||void 0===this)throw TypeError("Array.prototype.indexOf called on null or undefined");var o=r(this),a=o.length>>>0,s=n(0|t,a);if(s<0)s=i(0,a+s);else if(s>=a)return -1;if(void 0===e){for(;s!==a;++s)if(void 0===o[s]&&s in o)return s}else if(e!=e){for(;s!==a;++s)if(o[s]!=o[s])return s}else for(;s!==a;++s)if(o[s]===e)return s;return -1}))}),parcelRegister("b1M0n",function(e,t){Object.keys||(Object.keys=function(e){if(e!==Object(e))throw TypeError("Object.keys called on a non-object");var t,r=[];for(t in e)Object.prototype.hasOwnProperty.call(e,t)&&r.push(t);return r})}),parcelRegister("keJ9m",function(e,t){"use strict";var r,i=n(i);function n(e){return e||{}}var o=i.exports={};o.internalCreateIfNotExists=n;var a=a||parcelRequire("ccQZb"),s=s||parcelRequire("ds403"),u=u||parcelRequire("aJuQy");o.PropertyStructureDescriptionBuilder=function(){function e(e,i){var n;return o(e)?function(){return e}:i.propertyPatternTemplateMode?(n=i.propertyPattern,function(e){var i=r(n,"{{fieldName}}").exec(e);return i&&""!=i[1]?i[1]:t(e)}):function(e){return t(e)}}function t(e){var t=RegExp("(\\w+)$","gi"),r=e.match(t);return null!=r?r[0]:e}function r(e,t){var r=i(e);return"string"==typeof t&&(t=i(t)),RegExp(r="^"+(r=r.replace(t,"([-\\w]+)")),"i")}function i(e){var t=RegExp("([^-\\w])","gi");return e.replace(t,"\\$1")}function n(e,t){return o(e)?e:t}function o(e){return"string"==typeof e&&null!=e&&""!=e}return function(){this.description={type:"",category:"",abbreviation:"",image:"",propertyPatternTemplateMode:!1,propertyPattern:"",indexStartsWith:"",groupName:"group",groupPattern:"",groupDestinationPattern:"",groupDestinationName:null,deduplicationPattern:"",getDisplayNameForPropertyName:null,getFieldNameForPropertyName:null,matchesPropertyName:null},this.type=function(e){return this.description.type=n(e,""),this},this.category=function(e){return this.description.category=n(e,""),this},this.abbreviation=function(e){return this.description.abbreviation=n(e,""),this},this.image=function(e){return this.description.image=n(e,""),this},this.propertyPatternEqualMode=function(){return this.description.propertyPatternTemplateMode=!1,this},this.propertyPatternTemplateMode=function(){return this.description.propertyPatternTemplateMode=!0,this},this.propertyPattern=function(e){return this.description.propertyPattern=n(e,""),this},this.indexStartsWith=function(e){return this.description.indexStartsWith=n(e,""),this},this.displayPropertyName=function(t){var r,i;return this.description.getDisplayNameForPropertyName=e(t,this.description),o(t)||(this.description.getDisplayNameForPropertyName=(r=this.description.getDisplayNameForPropertyName,function(e){var t=r(e);return(t=null!=t?t:"").replace("_comma_separated_values","")}),this.description.getDisplayNameForPropertyName=(i=this.description.getDisplayNameForPropertyName,function(e){var t;return(t=i(e)).length>1?t.charAt(0).toUpperCase()+t.slice(1):t})),this},this.fieldName=function(t){return this.description.getFieldNameForPropertyName=e(t,this.description),this},this.groupName=function(e){return this.description.groupName=n(e,""),this},this.groupPattern=function(e){return this.description.groupPattern=n(e,""),this},this.groupDestinationPattern=function(e){return this.description.groupDestinationPattern=n(e,""),this},this.groupDestinationName=function(e){return this.description.groupDestinationName=n(e,this.description.groupName),this},this.deduplicationPattern=function(e){return this.description.deduplicationPattern=n(e,""),this},this.build=function(){var e,t;return this.description.matchesPropertyName=o(t=(e=this.description).propertyPattern)?e.propertyPatternTemplateMode?function(e){return null!=r(t,RegExp("\\\\\\{\\\\\\{[-\\w]+\\\\\\}\\\\\\}","gi")).exec(e)}:function(e){return e===t}:function(){return!1},null==this.description.getDisplayNameForPropertyName&&this.displayPropertyName(""),null==this.description.getFieldNameForPropertyName&&this.fieldName(""),null==this.description.groupDestinationName&&this.groupDestinationName(""),this.description}}}(),r=RegExp("\\[\\d+\\]","gi"),o.DescribedEntryCreator=function(e,t){var i=function(e,t){var r,i="",n=[];do(r=t.exec(e))&&(i.length>0&&(i+="."),i+=r[1],n.push(parseInt(r[1])));while(r)return{pointDelimited:i,numberArray:n}}(e.name,RegExp("\\[(\\d+)\\]","gi")),n=e.name.replace(r,""),o=new s.Resolver(this);this.category=t.category,this.type=t.type,this.abbreviation=t.abbreviation,this.image=t.image,this.index=i.numberArray,this.displayName=t.getDisplayNameForPropertyName(n),this.fieldName=t.getFieldNameForPropertyName(n),this.value=e.value,this.groupNames=[],this._isMatchingIndex=0==i.pointDelimited.indexOf(t.indexStartsWith),this._description=t,this._identifier={index:i.pointDelimited,propertyNameWithArrayIndices:e.name,propertyNameWithoutArrayIndices:n,groupId:"",groupDestinationId:"",deduplicationId:""},this._identifier.groupId=o.replaceResolvableFields(t.groupPattern,o.resolvableFieldsOfAll(this,this._description,this._identifier)),this._identifier.groupDestinationId=o.replaceResolvableFields(t.groupDestinationPattern,o.resolvableFieldsOfAll(this,this._description,this._identifier)),this._identifier.deduplicationId=o.replaceResolvableFields(t.deduplicationPattern,o.resolvableFieldsOfAll(this,this._description,this._identifier)),this.addGroupEntry=function(e,t){this.addGroupEntries(e,[t])},this.addGroupEntries=function(e,t){var r,i;for(this[e]||(this.groupNames.push(e),this[e]=[]),r=0;r<t.length;r+=1)i=t[r],this[e].push(i)}},o.Transform=function(){function e(e,r){return t(e.category,"")===t(r.category,"")&&t(e.type,"")===t(r.type,"")&&e.fieldName===r.fieldName&&e.value===r.value}function t(e,t){return void 0!==e&&e?e:t}return function(t){this.descriptions=t,this.config={debugMode:!1,maxRecursionDepth:8,removeDuplicationAboveRecursionDepth:1},this.enableDebugMode=function(){return this.config.debugMode=!0,this},this.setMaxRecursionDepth=function(e){if("number"!=typeof e||e<0)throw"Invalid max recursion depth value: "+e;return this.config.maxRecursionDepth=e,this},this.setRemoveDuplicationAboveRecursionDepth=function(e){if("number"!=typeof e||e<0)throw"Invalid remove duplications above recursion depth value: "+e;return this.config.removeDuplicationAboveRecursionDepth=e,this},this.processJson=function(t){return function(t,r,i){var n,s,l,c,p,d,h,f,g=a.flattenToArray(t);n=g,s=RegExp("\\[\\d+\\]$","gi"),l=[],c="",p="",n.filter(function(e){if(!e.name.match(s)){""!==c&&(l.push({name:c+"_comma_separated_values",value:p}),c=""),l.push(e);return}var t=e.name.replace(s,"");c===t?p+=", "+e.value:(""!==c&&(l.push({name:c+"_comma_separated_values",value:p}),c=""),c=t,p=e.value),l.push(e)}),g=l,i.debugMode&&(console.log("flattened data with array values:"),console.log(g));var m=[];for(f=0;f<r.length;f+=1){d=m,h=function(e,t){var r=RegExp("\\[\\d+\\]","gi"),i=[];return e.filter(function(e){var n=e.name.replace(r,"");if(t.matchesPropertyName(n)){var a=new o.DescribedEntryCreator(e,t);a._isMatchingIndex&&i.push(a)}}),i}(g,r[f]),m=null==d||0==d.length?h:function(e,t,r){var i,n,o,a=function(e,t){for(var r={},i=0;i<e.length;i++){var n=e[i];r[t(n)]=n}return r}(t,r),s=[];for(i=0;i<e.length;i+=1)(null==(o=r(n=e[i]))||""===o||null==a[o])&&s.push(n);for(i=0;i<t.length;i+=1)s.push(n=t[i]);return s}(d,h,function(e){return e._identifier.deduplicationId})}return g=m,i.debugMode&&(console.log("describedData data:"),console.log(g)),g=function(e,t,r){for(var i={},n=0;n<e.length;n++){var o=e[n],a=t(o);if(""!==a){var s=r(o);null!=s&&""!==s&&(i[a]||(i[a]=o),i[a].addGroupEntry(s,o))}}return i}(g,function(e){return e._identifier.groupId},function(e){return e._description.groupName}),i.debugMode&&(console.log("grouped describedData data:"),console.log(g)),g=function(e){for(var t=Object.keys(e),r=[],i=0;i<t.length;i++){var n=t[i],o=e[n];if(""!=o._description.groupDestinationPattern){var a=o._identifier.groupDestinationId;if(null!=e[a]){var s=o[o._description.groupName];e[a].addGroupEntries(o._description.groupDestinationName,s),r.push(n)}}}for(i=0;i<r.length;i+=1){var u=r[i];delete e[u]}return e}(g),i.debugMode&&(console.log("moved grouped describedData data:"),console.log(g)),g=function(t,r){var i,n=[];for(i=0;i<t.length;i+=1)n.push(function t(r,i){var n=new u.DescribedDataFieldBuilder().category(r.category).type(r.type).abbreviation(r.abbreviation).image(r.image).index(r.index).displayName(r.displayName).fieldName(r.fieldName).value(r.value).build();if(i.recursionDepth>i.config.maxRecursionDepth)return n;var o=null,a="",s=new u.DescribedDataFieldGroup(n);return function(e,t){var r,i,n,o;for(r=0;r<e.groupNames.length;r+=1)for(i=0,n=e.groupNames[r];i<e[n].length;i+=1)o=e[n][i],t(n,o,e[n])}(r,function(r,n,u){if(i.groupToSkip===r){i.config.debugMode&&console.log("Removed duplicate group "+r+" at recursion depth "+i.recursionDepth);return}a="",i.recursionDepth>=i.config.removeDuplicationAboveRecursionDepth&&(a=!function(e,t,r){if(e===t)return!0;if(null==e||null==t||e.length!==t.length)return!1;for(var i=0;i<e.length;++i)if(!r(e[i],t[i]))return!1;return!0}(n[r],u,e)?"":r),o={recursionDepth:i.recursionDepth+1,config:i.config,groupToSkip:a},s.addGroupEntry(r,t(n,o))}),n}(t[i],{recursionDepth:0,config:r,groupToSkip:""}));return n}(g=function(e){for(var t=[],r=Object.keys(e),i=0;i<r.length;i++){var n=e[r[i]];t.push(n)}return t}(g),i),i.debugMode&&(console.log("transformed result:"),console.log(g)),g}(t,this.descriptions,this.config)}}}(),o.Restructor={},o.Restructor.processJsonUsingDescriptions=function(e,t,r){var i=new o.Transform(t);return r&&i.enableDebugMode(),i.processJson(e)}}),parcelRegister("ccQZb",function(e,t){"use strict";var r=r||{};(r.exports={}).flattenToArray=function(e,t){var r=[];return("number"!=typeof t||t<1)&&(t=20),!function e(i,n,o){if(!(o>t)&&"function"!=typeof i)if(Object(i)!==i)r.push({name:n,value:i});else if(Array.isArray(i)){var a,s=i.length;for(a=0;a<s;a+=1)e(i[a],n+"["+a+"]",o+1);0===s&&(r[n]=[],r.push({name:n,value:""}))}else{var u,l=!0;for(u in i)l=!1,e(i[u],n?n+"."+u:u,o+1);l&&n&&r.push({name:n,value:""})}}(e,"",0),r}}),parcelRegister("ds403",function(e,t){"use strict";var r,i=n(i);function n(e){return e||{}}var o=i.exports={};o.internalCreateIfNotExists=n;var a=a||parcelRequire("ccQZb");r=RegExp("\\[\\d+\\]","gi"),o.Resolver=function(e){this.sourceDataObject=e,this.resolveTemplate=function(e){return this.replaceResolvableFields(e,function(e){var t,i,n,o,a=Object.keys(e);for(t=0;t<a.length;t+=1)o=e[i=a[t]],"fieldName"===(n=function(e){var t=e.lastIndexOf("."),i=e;t>0&&(i=e.substr(t+1));var n="";t>0&&(n=e.substr(0,t+1));var o=n.replace(r,"");return{group:n,groupWithoutArrayIndices:o,name:i}}(i)).name&&"fieldName"!==o&&(e[n.groupWithoutArrayIndices+o]=e[n.group+"value"]);return e}(this.resolvableFieldsOfAll(this.sourceDataObject)))},this.resolvableFieldsOfAll=function(){var e,t={},r=function(e){return 0!==e.indexOf("_")&&0>e.indexOf("._")};for(e=0;e<arguments.length;e+=1)!function(e,t,r){var i,n;for(i=0;i<e.length;i+=1)n=e[i],"function"==typeof r&&r(n.name)&&(t[n.name]=n.value)}(a.flattenToArray(arguments[e],3),t,r);return t},this.replaceResolvableFields=function(e,t){var r=e,i=Object.keys(t),n=0,o="",a="";for(n=0;n<i.length;n+=1)a=t[o=i[n]],r=r.replace("{{"+o+"}}",a);return r}}}),parcelRegister("aJuQy",function(e,t){"use strict";var r=i(r);function i(e){return e||{}}var n=r.exports={};n.internalCreateIfNotExists=i,n.DescribedDataFieldBuilder=function(){function e(e,t){return"string"==typeof e&&null!==e&&""!==e?e:t}return function(){this.describedField={category:"",type:"",abbreviation:"",image:"",index:[],groupNames:[],displayName:"",fieldName:"",value:""},this.fromDescribedDataField=function(e){return this.category(e.category),this.type(e.type),this.abbreviation(e.abbreviation),this.image(e.image),this.index(e.index),this.groupNames(e.groupNames),this.displayName(e.displayName),this.fieldName(e.fieldName),this.value(e.value),this},this.category=function(t){return this.describedField.category=e(t,""),this},this.type=function(t){return this.describedField.type=e(t,""),this},this.abbreviation=function(t){return this.describedField.abbreviation=e(t,""),this},this.image=function(t){return this.describedField.image=e(t,""),this},this.index=function(e){var t,r;return this.describedField.index=(r=[],null==(t=e)?r:t),this},this.groupNames=function(e){var t,r;return this.describedField.groupNames=(r=[],null==(t=e)?r:t),this},this.displayName=function(t){return this.describedField.displayName=e(t,""),this},this.fieldName=function(t){return this.describedField.fieldName=e(t,""),this},this.value=function(e){return this.describedField.value=e,this},this.build=function(){return this.describedField}}}(),n.copyWithoutGroups=function(e){return new n.DescribedDataFieldBuilder().fromDescribedDataField(e).groupNames([]).build()},n.DescribedDataFieldGroup=function(e){this.dataField=e,this.addGroupEntry=function(e,t){return this.addGroupEntries(e,[t]),this},this.addGroupEntries=function(e,t){var r,i;if(!e||0===e.length||!t||0===t.length)return this;for(void 0===this.dataField[e]&&(this.dataField.groupNames.push(e),this.dataField[e]=[]),r=0;r<t.length;r+=1)i=t[r],this.dataField[e].push(i);return this}}}),Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),Array.prototype.filter||(Array.prototype.filter=function(e,t){"use strict";if(!(("Function"==typeof e||"function"==typeof e)&&this))throw TypeError();var r,i=this.length>>>0,n=Array(i),o=0,a=-1;if(void 0===t)for(;++a!==i;)a in this&&(r=this[a],e(this[a],a,this)&&(n[o++]=r));else for(;++a!==i;)a in this&&(r=this[a],e.call(t,this[a],a,this)&&(n[o++]=r));return n.length=o,n}),parcelRequire("dED0n"),parcelRequire("b1M0n");var $keJ9m=parcelRequire("keJ9m");module.exports={datarestructor:$keJ9m};
1
+ var $parcel$global=globalThis,$parcel$modules={},$parcel$inits={},parcelRequire=$parcel$global.parcelRequirec1f2;null==parcelRequire&&((parcelRequire=function(e){if(e in $parcel$modules)return $parcel$modules[e].exports;if(e in $parcel$inits){var t=$parcel$inits[e];delete $parcel$inits[e];var r={id:e,exports:{}};return $parcel$modules[e]=r,t.call(r.exports,r,r.exports),r.exports}var i=Error("Cannot find module '"+e+"'");throw i.code="MODULE_NOT_FOUND",i}).register=function(e,t){$parcel$inits[e]=t},$parcel$global.parcelRequirec1f2=parcelRequire);"use strict";var parcelRegister=parcelRequire.register;parcelRegister("dED0n",function(e,t){var r,i,n;Array.prototype.indexOf||(Array.prototype.indexOf=(r=Object,i=Math.max,n=Math.min,function(e,t){if(this===null||void 0===this)throw TypeError("Array.prototype.indexOf called on null or undefined");var o=r(this),a=o.length>>>0,s=n(0|t,a);if(s<0)s=i(0,a+s);else if(s>=a)return -1;if(void 0===e){for(;s!==a;++s)if(void 0===o[s]&&s in o)return s}else if(e!=e){for(;s!==a;++s)if(o[s]!=o[s])return s}else for(;s!==a;++s)if(o[s]===e)return s;return -1}))}),parcelRegister("b1M0n",function(e,t){Object.keys||(Object.keys=function(e){if(e!==Object(e))throw TypeError("Object.keys called on a non-object");var t,r=[];for(t in e)Object.prototype.hasOwnProperty.call(e,t)&&r.push(t);return r})}),parcelRegister("keJ9m",function(e,t){"use strict";var r,i=n(i);function n(e){return e||{}}var o=i.exports={};o.internalCreateIfNotExists=n;var a=a||parcelRequire("ccQZb"),s=s||parcelRequire("ds403"),u=u||parcelRequire("aJuQy");o.PropertyStructureDescriptionBuilder=function(){function e(e,i){var n;return o(e)?function(){return e}:i.propertyPatternTemplateMode?(n=i.propertyPattern,function(e){var i=r(n,"{{fieldName}}").exec(e);return i&&""!=i[1]?i[1]:t(e)}):function(e){return t(e)}}function t(e){var t=RegExp("(\\w+)$","gi"),r=e.match(t);return null!=r?r[0]:e}function r(e,t){var r=i(e);return"string"==typeof t&&(t=i(t)),RegExp(r="^"+(r=r.replace(t,"([-\\w]+)")),"i")}function i(e){var t=RegExp("([^-\\w])","gi");return e.replace(t,"\\$1")}function n(e,t){return o(e)?e:t}function o(e){return"string"==typeof e&&null!=e&&""!=e}return function(){this.description={type:"",category:"",abbreviation:"",image:"",propertyPatternTemplateMode:!1,propertyPattern:"",indexStartsWith:"",groupName:"group",groupPattern:"",groupDestinationPattern:"",groupDestinationName:null,deduplicationPattern:"",getDisplayNameForPropertyName:null,getFieldNameForPropertyName:null,matchesPropertyName:null},this.type=function(e){return this.description.type=n(e,""),this},this.category=function(e){return this.description.category=n(e,""),this},this.abbreviation=function(e){return this.description.abbreviation=n(e,""),this},this.image=function(e){return this.description.image=n(e,""),this},this.propertyPatternEqualMode=function(){return this.description.propertyPatternTemplateMode=!1,this},this.propertyPatternTemplateMode=function(){return this.description.propertyPatternTemplateMode=!0,this},this.propertyPattern=function(e){return this.description.propertyPattern=n(e,""),this},this.indexStartsWith=function(e){return this.description.indexStartsWith=n(e,""),this},this.displayPropertyName=function(t){var r,i;return this.description.getDisplayNameForPropertyName=e(t,this.description),o(t)||(this.description.getDisplayNameForPropertyName=(r=this.description.getDisplayNameForPropertyName,function(e){var t=r(e);return(t=null!=t?t:"").replace("_comma_separated_values","")}),this.description.getDisplayNameForPropertyName=(i=this.description.getDisplayNameForPropertyName,function(e){var t;return(t=i(e)).length>1?t.charAt(0).toUpperCase()+t.slice(1):t})),this},this.fieldName=function(t){return this.description.getFieldNameForPropertyName=e(t,this.description),this},this.groupName=function(e){return this.description.groupName=n(e,""),this},this.groupPattern=function(e){return this.description.groupPattern=n(e,""),this},this.groupDestinationPattern=function(e){return this.description.groupDestinationPattern=n(e,""),this},this.groupDestinationName=function(e){return this.description.groupDestinationName=n(e,this.description.groupName),this},this.deduplicationPattern=function(e){return this.description.deduplicationPattern=n(e,""),this},this.build=function(){var e,t;return this.description.matchesPropertyName=o(t=(e=this.description).propertyPattern)?e.propertyPatternTemplateMode?function(e){return null!=r(t,RegExp("\\\\\\{\\\\\\{[-\\w]+\\\\\\}\\\\\\}","gi")).exec(e)}:function(e){return e===t}:function(){return!1},null==this.description.getDisplayNameForPropertyName&&this.displayPropertyName(""),null==this.description.getFieldNameForPropertyName&&this.fieldName(""),null==this.description.groupDestinationName&&this.groupDestinationName(""),this.description}}}(),r=RegExp("\\[\\d+\\]","gi"),o.DescribedEntryCreator=function(e,t){var i=function(e,t){var r,i="",n=[];do(r=t.exec(e))&&(i.length>0&&(i+="."),i+=r[1],n.push(parseInt(r[1])));while(r)return{pointDelimited:i,numberArray:n}}(e.name,RegExp("\\[(\\d+)\\]","gi")),n=e.name.replace(r,""),o=new s.Resolver(this);this.category=t.category,this.type=t.type,this.abbreviation=t.abbreviation,this.image=t.image,this.index=i.numberArray,this.displayName=t.getDisplayNameForPropertyName(n),this.fieldName=t.getFieldNameForPropertyName(n),this.value=e.value,this.groupNames=[],this._isMatchingIndex=0==i.pointDelimited.indexOf(t.indexStartsWith),this._description=t,this._identifier={index:i.pointDelimited,propertyNameWithArrayIndices:e.name,propertyNameWithoutArrayIndices:n,groupId:"",groupDestinationId:"",deduplicationId:""},this._identifier.groupId=o.replaceResolvableFields(t.groupPattern,o.resolvableFieldsOfAll(this,this._description,this._identifier)),this._identifier.groupDestinationId=o.replaceResolvableFields(t.groupDestinationPattern,o.resolvableFieldsOfAll(this,this._description,this._identifier)),this._identifier.deduplicationId=o.replaceResolvableFields(t.deduplicationPattern,o.resolvableFieldsOfAll(this,this._description,this._identifier)),this.addGroupEntry=function(e,t){this.addGroupEntries(e,[t])},this.addGroupEntries=function(e,t){var r,i;for(this[e]||(this.groupNames.push(e),this[e]=[]),r=0;r<t.length;r+=1)i=t[r],this[e].push(i)}},o.Transform=function(){function e(e,r){return t(e.category,"")===t(r.category,"")&&t(e.type,"")===t(r.type,"")&&e.fieldName===r.fieldName&&e.value===r.value}function t(e,t){return void 0!==e&&e?e:t}return function(t){this.descriptions=t,this.config={debugMode:!1,maxRecursionDepth:8,removeDuplicationAboveRecursionDepth:1},this.enableDebugMode=function(){return this.config.debugMode=!0,this},this.setMaxRecursionDepth=function(e){if("number"!=typeof e||e<0)throw"Invalid max recursion depth value: "+e;return this.config.maxRecursionDepth=e,this},this.setRemoveDuplicationAboveRecursionDepth=function(e){if("number"!=typeof e||e<0)throw"Invalid remove duplications above recursion depth value: "+e;return this.config.removeDuplicationAboveRecursionDepth=e,this},this.processJson=function(t){return function(t,r,i){var n,s,l,c,p,d,h,f,g=a.flattenToArray(t);n=g,s=RegExp("\\[\\d+\\]$","gi"),l=[],c="",p="",n.filter(function(e){if(!e.name.match(s)){""!==c&&(l.push({name:c+"_comma_separated_values",value:p}),c=""),l.push(e);return}var t=e.name.replace(s,"");c===t?p+=", "+e.value:(""!==c&&(l.push({name:c+"_comma_separated_values",value:p}),c=""),c=t,p=e.value),l.push(e)}),g=l,i.debugMode&&(console.log("flattened data with array values:"),console.log(g));var m=[];for(f=0;f<r.length;f+=1){d=m,h=function(e,t){var r=RegExp("\\[\\d+\\]","gi"),i=[];return e.filter(function(e){var n=e.name.replace(r,"");if(t.matchesPropertyName(n)){var a=new o.DescribedEntryCreator(e,t);a._isMatchingIndex&&i.push(a)}}),i}(g,r[f]),m=null==d||0==d.length?h:function(e,t,r){var i,n,o,a=function(e,t){for(var r={},i=0;i<e.length;i++){var n=e[i];r[t(n)]=n}return r}(t,r),s=[];for(i=0;i<e.length;i+=1)(null==(o=r(n=e[i]))||""===o||null==a[o])&&s.push(n);for(i=0;i<t.length;i+=1)s.push(n=t[i]);return s}(d,h,function(e){return e._identifier.deduplicationId})}return g=m,i.debugMode&&(console.log("describedData data:"),console.log(g)),g=function(e,t,r){for(var i={},n=0;n<e.length;n++){var o=e[n],a=t(o);if(""!==a){var s=r(o);null!=s&&""!==s&&(i[a]||(i[a]=o),i[a].addGroupEntry(s,o))}}return i}(g,function(e){return e._identifier.groupId},function(e){return e._description.groupName}),i.debugMode&&(console.log("grouped describedData data:"),console.log(g)),g=function(e){for(var t=Object.keys(e),r=[],i=0;i<t.length;i++){var n=t[i],o=e[n];if(""!=o._description.groupDestinationPattern){var a=o._identifier.groupDestinationId;if(null!=e[a]){var s=o[o._description.groupName];e[a].addGroupEntries(o._description.groupDestinationName,s),r.push(n)}}}for(i=0;i<r.length;i+=1){var u=r[i];delete e[u]}return e}(g),i.debugMode&&(console.log("moved grouped describedData data:"),console.log(g)),g=function(t,r){var i,n=[];for(i=0;i<t.length;i+=1)n.push(function t(r,i){var n=new u.DescribedDataFieldBuilder().category(r.category).type(r.type).abbreviation(r.abbreviation).image(r.image).index(r.index).displayName(r.displayName).fieldName(r.fieldName).value(r.value).build();if(i.recursionDepth>i.config.maxRecursionDepth)return n;var o=null,a="",s=new u.DescribedDataFieldGroup(n);return function(e,t){var r,i,n,o;for(r=0;r<e.groupNames.length;r+=1)for(i=0,n=e.groupNames[r];i<e[n].length;i+=1)o=e[n][i],t(n,o,e[n])}(r,function(r,n,u){if(i.groupToSkip===r){i.config.debugMode&&console.log("Removed duplicate group "+r+" at recursion depth "+i.recursionDepth);return}a="",i.recursionDepth>=i.config.removeDuplicationAboveRecursionDepth&&(a=!function(e,t,r){if(e===t)return!0;if(null==e||null==t||e.length!==t.length)return!1;for(var i=0;i<e.length;++i)if(!r(e[i],t[i]))return!1;return!0}(n[r],u,e)?"":r),o={recursionDepth:i.recursionDepth+1,config:i.config,groupToSkip:a},s.addGroupEntry(r,t(n,o))}),n}(t[i],{recursionDepth:0,config:r,groupToSkip:""}));return n}(g=function(e){for(var t=[],r=Object.keys(e),i=0;i<r.length;i++){var n=e[r[i]];t.push(n)}return t}(g),i),i.debugMode&&(console.log("transformed result:"),console.log(g)),g}(t,this.descriptions,this.config)}}}(),o.Restructor={},o.Restructor.processJsonUsingDescriptions=function(e,t,r){var i=new o.Transform(t);return r&&i.enableDebugMode(),i.processJson(e)}}),parcelRegister("ccQZb",function(e,t){"use strict";var r=r||{};(r.exports={}).flattenToArray=function(e,t){var r=[];return("number"!=typeof t||t<1)&&(t=20),!function e(i,n,o){if(!(o>t)&&"function"!=typeof i)if(Object(i)!==i)r.push({name:n,value:i});else if(Array.isArray(i)){var a,s=i.length;for(a=0;a<s;a+=1)e(i[a],n+"["+a+"]",o+1);0===s&&(r[n]=[],r.push({name:n,value:""}))}else{var u,l=!0;for(u in i)l=!1,e(i[u],n?n+"."+u:u,o+1);l&&n&&r.push({name:n,value:""})}}(e,"",0),r}}),parcelRegister("ds403",function(e,t){"use strict";var r,i=n(i);function n(e){return e||{}}var o=i.exports={};o.internalCreateIfNotExists=n;var a=a||parcelRequire("ccQZb");r=RegExp("\\[\\d+\\]","gi"),o.Resolver=function(e){this.sourceDataObject=e,this.resolveTemplate=function(e){return this.replaceResolvableFields(e,function(e){var t,i,n,o,a=Object.keys(e);for(t=0;t<a.length;t+=1)o=e[i=a[t]],"fieldName"===(n=function(e){var t=e.lastIndexOf("."),i=e;t>0&&(i=e.substr(t+1));var n="";t>0&&(n=e.substr(0,t+1));var o=n.replace(r,"");return{group:n,groupWithoutArrayIndices:o,name:i}}(i)).name&&"fieldName"!==o&&(e[n.groupWithoutArrayIndices+o]=e[n.group+"value"]);return e}(this.resolvableFieldsOfAll(this.sourceDataObject)))},this.resolvableFieldsOfAll=function(){var e,t={},r=function(e){return 0!==e.indexOf("_")&&0>e.indexOf("._")};for(e=0;e<arguments.length;e+=1)!function(e,t,r){var i,n;for(i=0;i<e.length;i+=1)n=e[i],"function"==typeof r&&r(n.name)&&(t[n.name]=n.value)}(a.flattenToArray(arguments[e],3),t,r);return t},this.replaceResolvableFields=function(e,t){for(var r=e,i=Object.keys(t),n=0;n<i.length;n+=1){var o=i[n],a=t[o];r=r.replace("{{"+o+"}}",a)}return r}}}),parcelRegister("aJuQy",function(e,t){"use strict";var r=i(r);function i(e){return e||{}}var n=r.exports={};n.internalCreateIfNotExists=i,n.DescribedDataFieldBuilder=function(){function e(e,t){return"string"==typeof e&&null!==e&&""!==e?e:t}return function(){this.describedField={category:"",type:"",abbreviation:"",image:"",index:[],groupNames:[],displayName:"",fieldName:"",value:""},this.fromDescribedDataField=function(e){return this.category(e.category),this.type(e.type),this.abbreviation(e.abbreviation),this.image(e.image),this.index(e.index),this.groupNames(e.groupNames),this.displayName(e.displayName),this.fieldName(e.fieldName),this.value(e.value),this},this.category=function(t){return this.describedField.category=e(t,""),this},this.type=function(t){return this.describedField.type=e(t,""),this},this.abbreviation=function(t){return this.describedField.abbreviation=e(t,""),this},this.image=function(t){return this.describedField.image=e(t,""),this},this.index=function(e){var t,r;return this.describedField.index=(r=[],null==(t=e)?r:t),this},this.groupNames=function(e){var t,r;return this.describedField.groupNames=(r=[],null==(t=e)?r:t),this},this.displayName=function(t){return this.describedField.displayName=e(t,""),this},this.fieldName=function(t){return this.describedField.fieldName=e(t,""),this},this.value=function(e){return this.describedField.value=e,this},this.build=function(){return this.describedField}}}(),n.copyWithoutGroups=function(e){return new n.DescribedDataFieldBuilder().fromDescribedDataField(e).groupNames([]).build()},n.DescribedDataFieldGroup=function(e){this.dataField=e,this.addGroupEntry=function(e,t){return this.addGroupEntries(e,[t]),this},this.addGroupEntries=function(e,t){var r,i;if(!e||0===e.length||!t||0===t.length)return this;for(void 0===this.dataField[e]&&(this.dataField.groupNames.push(e),this.dataField[e]=[]),r=0;r<t.length;r+=1)i=t[r],this.dataField[e].push(i);return this}}}),Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),Array.prototype.filter||(Array.prototype.filter=function(e,t){"use strict";if(!(("Function"==typeof e||"function"==typeof e)&&this))throw TypeError();var r,i=this.length>>>0,n=Array(i),o=0,a=-1;if(void 0===t)for(;++a!==i;)a in this&&(r=this[a],e(this[a],a,this)&&(n[o++]=r));else for(;++a!==i;)a in this&&(r=this[a],e.call(t,this[a],a,this)&&(n[o++]=r));return n.length=o,n}),parcelRequire("dED0n"),parcelRequire("b1M0n");var $keJ9m=parcelRequire("keJ9m");module.exports={datarestructor:$keJ9m};
2
2
  //# sourceMappingURL=datarestructor-ie.js.map