"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/defineProperty"),t=require("lodash"),r=require("../convert.js"),n=require("./goalsConfig.js");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=o(e);function c(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?c(Object(r),!0).forEach((function(t){i.default(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):c(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}exports.convertGoalValue=function(e,o){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"TO_SHOW";if(!n.GoalsConfig[o])return e;var c=n.GoalsConfig[o],a=c.unitType,l=c.unit,u=c.convertToShow,f=c.convertToSave;if(!(l||a||u||f))return e;if("TO_SHOW"===i){if(""===e)return e;var s=u?u(+e):r.convertValue(+e,a,l,void 0,16),p=t.round(s,2),g=String(p);return g}return"TO_SAVE"===i?e?String(f?f(+e):r.convertValue(+e,a,r.getUnitPreference(a),l,16)):"":void 0},exports.getGoalsConfig=function(){return a(a({},n.GoalsConfig),{},{cost_per_ft:a(a({},n.GoalsConfig.cost_per_ft),{},{label:"Cost/".concat(r.getUnitDescription(r.getUnitPreference("length")).singular)}),cost_per_lat_ft:a(a({},n.GoalsConfig.cost_per_lat_ft),{},{label:"Lateral Cost/".concat(r.getUnitDescription(r.getUnitPreference("length")).singular)})})},exports.getGoalsUnitDisplay=function(e){if(!n.GoalsConfig[e])return"";var t=n.GoalsConfig[e],o=t.unit,i=t.unitType,c=t.formatUnitDisplay;return i||c?c?c(r.getUnitPreference(null!=i?i:"")):"percent"===i?o:r.getUnitDisplay(i):""};
//# sourceMappingURL=utils.js.map
