{"version":3,"sources":["webpack:///./src/modules/autocheck/components/AutoCheckMileage.vue","webpack:///src/modules/autocheck/components/AutoCheckMileage.vue","webpack:///./src/modules/autocheck/components/AutoCheckMileage.vue?9c34","webpack:///./src/modules/autocheck/components/AutoCheckMileage.vue?4eb0","webpack:///./node_modules/accounting/accounting.js"],"names":["render","_vm","this","_c","_self","staticClass","_m","count","_e","_v","mileage","class","anomaly","data","inputMileage","_s","formatNumber","directives","name","rawName","value","placement","trigger","sticky","hideOnClick","showOnLoad","expression","attrs","_l","items","item","index","key","formatDate","dateOfInformation","sourceOfMileage","subSourceOfMileage","mileageData","staticRenderFns","props","type","Object","required","Number","default","computed","mileageItemsCount","mileageItems","methods","userInput","mileageAnomaly","component","root","undefined","lib","currency","symbol","format","decimal","thousand","precision","grouping","number","nativeMap","Array","prototype","map","nativeIsArray","isArray","toString","isString","obj","charCodeAt","substr","call","isObject","defaults","object","defs","hasOwnProperty","iterator","context","i","j","results","length","checkPrecision","val","base","Math","round","abs","isNaN","checkCurrencyFormat","settings","match","pos","neg","replace","zero","unformat","parse","regex","RegExp","unformatted","parseFloat","toFixed","power","pow","opts","usePrecision","negative","parseInt","mod","split","formatMoney","formats","useFormat","formatColumn","list","padAfterSymbol","indexOf","maxLength","formatted","fVal","join","module","exports","accounting"],"mappings":"0IAAA,IAAIA,EAAS,WAAkB,IAAIC,EAAIC,KAAKC,EAAGF,EAAIG,MAAMD,GAAG,OAAOA,EAAG,MAAM,CAACA,EAAG,MAAM,CAACE,YAAY,WAAW,CAACJ,EAAIK,GAAG,GAAGH,EAAG,MAAM,CAACE,YAAY,oBAAoB,CAACF,EAAG,IAAI,CAACE,YAAY,cAAc,CAAGJ,EAAIM,MAAoEN,EAAIO,KAAjEL,EAAG,OAAO,CAACE,YAAY,oBAAoB,CAACJ,EAAIQ,GAAG,gBAAyBN,EAAG,MAAM,CAACE,YAAY,OAAO,CAAEJ,EAAIS,SAAWT,EAAIM,MAAOJ,EAAG,MAAM,CAACE,YAAY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Class:\"columns\"},[_vm._m(0),_c('div',{staticClass:\"column is-narrow\"},[_c('p',{staticClass:\"title is-6\"},[(!_vm.count)?_c('span',{staticClass:\"has-text-success\"},[_vm._v(\"None\")]):_vm._e()])])]),_c('div',{staticClass:\"box\"},[(_vm.mileage && _vm.count)?_c('div',{staticClass:\"columns\"},[_c('div',{staticClass:\"column\"},[_c('p',{staticClass:\"has-text-grey-light\"},[_vm._v(\"\\n Input mileage\\n \")]),_c('p',{staticClass:\"subtitle is-4\",class:{ 'has-text-danger': _vm.anomaly(_vm.data.inputMileage, 0, true) }},[_c('span',[_vm._v(_vm._s(_vm.formatNumber(_vm.mileage)))]),(_vm.anomaly(_vm.data.inputMileage, 0, true))?_c('span',{directives:[{name:\"tippy\",rawName:\"v-tippy\",value:({\n placement: 'right',\n trigger: 'click',\n sticky: true,\n hideOnClick: false,\n showOnLoad: true\n }),expression:\"{\\n placement: 'right',\\n trigger: 'click',\\n sticky: true,\\n hideOnClick: false,\\n showOnLoad: true\\n }\"}],staticClass:\"icon\",attrs:{\"title\":\"Anomaly\"}},[_c('i',{staticClass:\"fal fa-exclamation-triangle\"})]):_vm._e()])])]):_vm._e(),(_vm.count)?_c('table',{staticClass:\"table is-fullwidth is-striped\"},[_vm._m(1),_c('tbody',_vm._l((_vm.items),function(item,index){return _c('tr',{key:index},[_c('td',{class:{ 'has-text-danger': _vm.anomaly(item.mileage, index) }},[_vm._v(\"\\n \"+_vm._s(_vm.formatNumber(item.mileage))+\"\\n \"),(_vm.anomaly(item.mileage, index))?_c('span',{directives:[{name:\"tippy\",rawName:\"v-tippy\",value:({\n placement: 'right',\n trigger: 'click',\n sticky: true,\n hideOnClick: false,\n showOnLoad: true\n }),expression:\"{\\n placement: 'right',\\n trigger: 'click',\\n sticky: true,\\n hideOnClick: false,\\n showOnLoad: true\\n }\"}],staticClass:\"icon\",attrs:{\"title\":\"Anomaly\"}},[_c('i',{staticClass:\"fal fa-exclamation-triangle\"})]):_vm._e()]),_c('td',[_vm._v(\"\\n \"+_vm._s(_vm.formatDate(item.dateOfInformation))+\"\\n \")]),_c('td',[_vm._v(_vm._s(item.sourceOfMileage)+\" - \"+_vm._s(item.subSourceOfMileage))])])}),0)]):(_vm.mileageData && !_vm.count)?_c('div',[_c('p',[_vm._v(\"\\n Mileage data not available, you have not been charged for this request\\n \")])]):(!_vm.mileageData)?_c('div',[_c('p',[_vm._v(\"Mileage data not requested\")])]):_vm._e()])])\n}\nvar staticRenderFns = [function (){var _vm=this,_c=_vm._self._c;return _c('div',{staticClass:\"column\"},[_c('p',{staticClass:\"title has-text-grey-light is-6\"},[_vm._v(\"\\n Mileage history\\n \")])])\n},function (){var _vm=this,_c=_vm._self._c;return _c('thead',[_c('tr',[_c('td',[_vm._v(\"Mileage\")]),_c('td',[_vm._v(\"Date\")]),_c('td',[_vm._v(\"Source\")])])])\n}]\n\nexport { render, staticRenderFns }","\r\n\r\n\r\n","import mod from \"-!../../../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../../../node_modules/thread-loader/dist/cjs.js!../../../../node_modules/babel-loader/lib/index.js!../../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./AutoCheckMileage.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../../../node_modules/thread-loader/dist/cjs.js!../../../../node_modules/babel-loader/lib/index.js!../../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./AutoCheckMileage.vue?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./AutoCheckMileage.vue?vue&type=template&id=59a70fde&\"\nimport script from \"./AutoCheckMileage.vue?vue&type=script&lang=js&\"\nexport * from \"./AutoCheckMileage.vue?vue&type=script&lang=js&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n null,\n null\n \n)\n\nexport default component.exports","/*!\n * accounting.js v0.4.1\n * Copyright 2014 Open Exchange Rates\n *\n * Freely distributable under the MIT license.\n * Portions of accounting.js are inspired or borrowed from underscore.js\n *\n * Full details and documentation:\n * http://openexchangerates.github.io/accounting.js/\n */\n\n(function(root, undefined) {\n\n\t/* --- Setup --- */\n\n\t// Create the local library object, to be exported or referenced globally later\n\tvar lib = {};\n\n\t// Current version\n\tlib.version = '0.4.1';\n\n\n\t/* --- Exposed settings --- */\n\n\t// The library's settings configuration object. Contains default parameters for\n\t// currency and number formatting\n\tlib.settings = {\n\t\tcurrency: {\n\t\t\tsymbol : \"$\",\t\t// default currency symbol is '$'\n\t\t\tformat : \"%s%v\",\t// controls output: %s = symbol, %v = value (can be object, see docs)\n\t\t\tdecimal : \".\",\t\t// decimal point separator\n\t\t\tthousand : \",\",\t\t// thousands separator\n\t\t\tprecision : 2,\t\t// decimal places\n\t\t\tgrouping : 3\t\t// digit grouping (not implemented yet)\n\t\t},\n\t\tnumber: {\n\t\t\tprecision : 0,\t\t// default precision on numbers is 0\n\t\t\tgrouping : 3,\t\t// digit grouping (not implemented yet)\n\t\t\tthousand : \",\",\n\t\t\tdecimal : \".\"\n\t\t}\n\t};\n\n\n\t/* --- Internal Helper Methods --- */\n\n\t// Store reference to possibly-available ECMAScript 5 methods for later\n\tvar nativeMap = Array.prototype.map,\n\t\tnativeIsArray = Array.isArray,\n\t\ttoString = Object.prototype.toString;\n\n\t/**\n\t * Tests whether supplied parameter is a string\n\t * from underscore.js\n\t */\n\tfunction isString(obj) {\n\t\treturn !!(obj === '' || (obj && obj.charCodeAt && obj.substr));\n\t}\n\n\t/**\n\t * Tests whether supplied parameter is a string\n\t * from underscore.js, delegates to ECMA5's native Array.isArray\n\t */\n\tfunction isArray(obj) {\n\t\treturn nativeIsArray ? nativeIsArray(obj) : toString.call(obj) === '[object Array]';\n\t}\n\n\t/**\n\t * Tests whether supplied parameter is a true object\n\t */\n\tfunction isObject(obj) {\n\t\treturn obj && toString.call(obj) === '[object Object]';\n\t}\n\n\t/**\n\t * Extends an object with a defaults object, similar to underscore's _.defaults\n\t *\n\t * Used for abstracting parameter handling from API methods\n\t */\n\tfunction defaults(object, defs) {\n\t\tvar key;\n\t\tobject = object || {};\n\t\tdefs = defs || {};\n\t\t// Iterate over object non-prototype properties:\n\t\tfor (key in defs) {\n\t\t\tif (defs.hasOwnProperty(key)) {\n\t\t\t\t// Replace values with defaults only if undefined (allow empty/zero values):\n\t\t\t\tif (object[key] == null) object[key] = defs[key];\n\t\t\t}\n\t\t}\n\t\treturn object;\n\t}\n\n\t/**\n\t * Implementation of `Array.map()` for iteration loops\n\t *\n\t * Returns a new Array as a result of calling `iterator` on each array value.\n\t * Defers to native Array.map if available\n\t */\n\tfunction map(obj, iterator, context) {\n\t\tvar results = [], i, j;\n\n\t\tif (!obj) return results;\n\n\t\t// Use native .map method if it exists:\n\t\tif (nativeMap && obj.map === nativeMap) return obj.map(iterator, context);\n\n\t\t// Fallback for native .map:\n\t\tfor (i = 0, j = obj.length; i < j; i++ ) {\n\t\t\tresults[i] = iterator.call(context, obj[i], i, obj);\n\t\t}\n\t\treturn results;\n\t}\n\n\t/**\n\t * Check and normalise the value of precision (must be positive integer)\n\t */\n\tfunction checkPrecision(val, base) {\n\t\tval = Math.round(Math.abs(val));\n\t\treturn isNaN(val)? base : val;\n\t}\n\n\n\t/**\n\t * Parses a format string or object and returns format obj for use in rendering\n\t *\n\t * `format` is either a string with the default (positive) format, or object\n\t * containing `pos` (required), `neg` and `zero` values (or a function returning\n\t * either a string or object)\n\t *\n\t * Either string or format.pos must contain \"%v\" (value) to be valid\n\t */\n\tfunction checkCurrencyFormat(format) {\n\t\tvar defaults = lib.settings.currency.format;\n\n\t\t// Allow function as format parameter (should return string or object):\n\t\tif ( typeof format === \"function\" ) format = format();\n\n\t\t// Format can be a string, in which case `value` (\"%v\") must be present:\n\t\tif ( isString( format ) && format.match(\"%v\") ) {\n\n\t\t\t// Create and return positive, negative and zero formats:\n\t\t\treturn {\n\t\t\t\tpos : format,\n\t\t\t\tneg : format.replace(\"-\", \"\").replace(\"%v\", \"-%v\"),\n\t\t\t\tzero : format\n\t\t\t};\n\n\t\t// If no format, or object is missing valid positive value, use defaults:\n\t\t} else if ( !format || !format.pos || !format.pos.match(\"%v\") ) {\n\n\t\t\t// If defaults is a string, casts it to an object for faster checking next time:\n\t\t\treturn ( !isString( defaults ) ) ? defaults : lib.settings.currency.format = {\n\t\t\t\tpos : defaults,\n\t\t\t\tneg : defaults.replace(\"%v\", \"-%v\"),\n\t\t\t\tzero : defaults\n\t\t\t};\n\n\t\t}\n\t\t// Otherwise, assume format was fine:\n\t\treturn format;\n\t}\n\n\n\t/* --- API Methods --- */\n\n\t/**\n\t * Takes a string/array of strings, removes all formatting/cruft and returns the raw float value\n\t * Alias: `accounting.parse(string)`\n\t *\n\t * Decimal must be included in the regular expression to match floats (defaults to\n\t * accounting.settings.number.decimal), so if the number uses a non-standard decimal \n\t * separator, provide it as the second argument.\n\t *\n\t * Also matches bracketed negatives (eg. \"$ (1.99)\" => -1.99)\n\t *\n\t * Doesn't throw any errors (`NaN`s become 0) but this may change in future\n\t */\n\tvar unformat = lib.unformat = lib.parse = function(value, decimal) {\n\t\t// Recursively unformat arrays:\n\t\tif (isArray(value)) {\n\t\t\treturn map(value, function(val) {\n\t\t\t\treturn unformat(val, decimal);\n\t\t\t});\n\t\t}\n\n\t\t// Fails silently (need decent errors):\n\t\tvalue = value || 0;\n\n\t\t// Return the value as-is if it's already a number:\n\t\tif (typeof value === \"number\") return value;\n\n\t\t// Default decimal point comes from settings, but could be set to eg. \",\" in opts:\n\t\tdecimal = decimal || lib.settings.number.decimal;\n\n\t\t // Build regex to strip out everything except digits, decimal point and minus sign:\n\t\tvar regex = new RegExp(\"[^0-9-\" + decimal + \"]\", [\"g\"]),\n\t\t\tunformatted = parseFloat(\n\t\t\t\t(\"\" + value)\n\t\t\t\t.replace(/\\((.*)\\)/, \"-$1\") // replace bracketed values with negatives\n\t\t\t\t.replace(regex, '') // strip out any cruft\n\t\t\t\t.replace(decimal, '.') // make sure decimal point is standard\n\t\t\t);\n\n\t\t// This will fail silently which may cause trouble, let's wait and see:\n\t\treturn !isNaN(unformatted) ? unformatted : 0;\n\t};\n\n\n\t/**\n\t * Implementation of toFixed() that treats floats more like decimals\n\t *\n\t * Fixes binary rounding issues (eg. (0.615).toFixed(2) === \"0.61\") that present\n\t * problems for accounting- and finance-related software.\n\t */\n\tvar toFixed = lib.toFixed = function(value, precision) {\n\t\tprecision = checkPrecision(precision, lib.settings.number.precision);\n\t\tvar power = Math.pow(10, precision);\n\n\t\t// Multiply up by precision, round accurately, then divide and use native toFixed():\n\t\treturn (Math.round(lib.unformat(value) * power) / power).toFixed(precision);\n\t};\n\n\n\t/**\n\t * Format a number, with comma-separated thousands and custom precision/decimal places\n\t * Alias: `accounting.format()`\n\t *\n\t * Localise by overriding the precision and thousand / decimal separators\n\t * 2nd parameter `precision` can be an object matching `settings.number`\n\t */\n\tvar formatNumber = lib.formatNumber = lib.format = function(number, precision, thousand, decimal) {\n\t\t// Resursively format arrays:\n\t\tif (isArray(number)) {\n\t\t\treturn map(number, function(val) {\n\t\t\t\treturn formatNumber(val, precision, thousand, decimal);\n\t\t\t});\n\t\t}\n\n\t\t// Clean up number:\n\t\tnumber = unformat(number);\n\n\t\t// Build options object from second param (if object) or all params, extending defaults:\n\t\tvar opts = defaults(\n\t\t\t\t(isObject(precision) ? precision : {\n\t\t\t\t\tprecision : precision,\n\t\t\t\t\tthousand : thousand,\n\t\t\t\t\tdecimal : decimal\n\t\t\t\t}),\n\t\t\t\tlib.settings.number\n\t\t\t),\n\n\t\t\t// Clean up precision\n\t\t\tusePrecision = checkPrecision(opts.precision),\n\n\t\t\t// Do some calc:\n\t\t\tnegative = number < 0 ? \"-\" : \"\",\n\t\t\tbase = parseInt(toFixed(Math.abs(number || 0), usePrecision), 10) + \"\",\n\t\t\tmod = base.length > 3 ? base.length % 3 : 0;\n\n\t\t// Format the number:\n\t\treturn negative + (mod ? base.substr(0, mod) + opts.thousand : \"\") + base.substr(mod).replace(/(\\d{3})(?=\\d)/g, \"$1\" + opts.thousand) + (usePrecision ? opts.decimal + toFixed(Math.abs(number), usePrecision).split('.')[1] : \"\");\n\t};\n\n\n\t/**\n\t * Format a number into currency\n\t *\n\t * Usage: accounting.formatMoney(number, symbol, precision, thousandsSep, decimalSep, format)\n\t * defaults: (0, \"$\", 2, \",\", \".\", \"%s%v\")\n\t *\n\t * Localise by overriding the symbol, precision, thousand / decimal separators and format\n\t * Second param can be an object matching `settings.currency` which is the easiest way.\n\t *\n\t * To do: tidy up the parameters\n\t */\n\tvar formatMoney = lib.formatMoney = function(number, symbol, precision, thousand, decimal, format) {\n\t\t// Resursively format arrays:\n\t\tif (isArray(number)) {\n\t\t\treturn map(number, function(val){\n\t\t\t\treturn formatMoney(val, symbol, precision, thousand, decimal, format);\n\t\t\t});\n\t\t}\n\n\t\t// Clean up number:\n\t\tnumber = unformat(number);\n\n\t\t// Build options object from second param (if object) or all params, extending defaults:\n\t\tvar opts = defaults(\n\t\t\t\t(isObject(symbol) ? symbol : {\n\t\t\t\t\tsymbol : symbol,\n\t\t\t\t\tprecision : precision,\n\t\t\t\t\tthousand : thousand,\n\t\t\t\t\tdecimal : decimal,\n\t\t\t\t\tformat : format\n\t\t\t\t}),\n\t\t\t\tlib.settings.currency\n\t\t\t),\n\n\t\t\t// Check format (returns object with pos, neg and zero):\n\t\t\tformats = checkCurrencyFormat(opts.format),\n\n\t\t\t// Choose which format to use for this value:\n\t\t\tuseFormat = number > 0 ? formats.pos : number < 0 ? formats.neg : formats.zero;\n\n\t\t// Return with currency symbol added:\n\t\treturn useFormat.replace('%s', opts.symbol).replace('%v', formatNumber(Math.abs(number), checkPrecision(opts.precision), opts.thousand, opts.decimal));\n\t};\n\n\n\t/**\n\t * Format a list of numbers into an accounting column, padding with whitespace\n\t * to line up currency symbols, thousand separators and decimals places\n\t *\n\t * List should be an array of numbers\n\t * Second parameter can be an object containing keys that match the params\n\t *\n\t * Returns array of accouting-formatted number strings of same length\n\t *\n\t * NB: `white-space:pre` CSS rule is required on the list container to prevent\n\t * browsers from collapsing the whitespace in the output strings.\n\t */\n\tlib.formatColumn = function(list, symbol, precision, thousand, decimal, format) {\n\t\tif (!list) return [];\n\n\t\t// Build options object from second param (if object) or all params, extending defaults:\n\t\tvar opts = defaults(\n\t\t\t\t(isObject(symbol) ? symbol : {\n\t\t\t\t\tsymbol : symbol,\n\t\t\t\t\tprecision : precision,\n\t\t\t\t\tthousand : thousand,\n\t\t\t\t\tdecimal : decimal,\n\t\t\t\t\tformat : format\n\t\t\t\t}),\n\t\t\t\tlib.settings.currency\n\t\t\t),\n\n\t\t\t// Check format (returns object with pos, neg and zero), only need pos for now:\n\t\t\tformats = checkCurrencyFormat(opts.format),\n\n\t\t\t// Whether to pad at start of string or after currency symbol:\n\t\t\tpadAfterSymbol = formats.pos.indexOf(\"%s\") < formats.pos.indexOf(\"%v\") ? true : false,\n\n\t\t\t// Store value for the length of the longest string in the column:\n\t\t\tmaxLength = 0,\n\n\t\t\t// Format the list according to options, store the length of the longest string:\n\t\t\tformatted = map(list, function(val, i) {\n\t\t\t\tif (isArray(val)) {\n\t\t\t\t\t// Recursively format columns if list is a multi-dimensional array:\n\t\t\t\t\treturn lib.formatColumn(val, opts);\n\t\t\t\t} else {\n\t\t\t\t\t// Clean up the value\n\t\t\t\t\tval = unformat(val);\n\n\t\t\t\t\t// Choose which format to use for this value (pos, neg or zero):\n\t\t\t\t\tvar useFormat = val > 0 ? formats.pos : val < 0 ? formats.neg : formats.zero,\n\n\t\t\t\t\t\t// Format this value, push into formatted list and save the length:\n\t\t\t\t\t\tfVal = useFormat.replace('%s', opts.symbol).replace('%v', formatNumber(Math.abs(val), checkPrecision(opts.precision), opts.thousand, opts.decimal));\n\n\t\t\t\t\tif (fVal.length > maxLength) maxLength = fVal.length;\n\t\t\t\t\treturn fVal;\n\t\t\t\t}\n\t\t\t});\n\n\t\t// Pad each number in the list and send back the column of numbers:\n\t\treturn map(formatted, function(val, i) {\n\t\t\t// Only if this is a string (not a nested array, which would have already been padded):\n\t\t\tif (isString(val) && val.length < maxLength) {\n\t\t\t\t// Depending on symbol position, pad after symbol or at index 0:\n\t\t\t\treturn padAfterSymbol ? val.replace(opts.symbol, opts.symbol+(new Array(maxLength - val.length + 1).join(\" \"))) : (new Array(maxLength - val.length + 1).join(\" \")) + val;\n\t\t\t}\n\t\t\treturn val;\n\t\t});\n\t};\n\n\n\t/* --- Module Definition --- */\n\n\t// Export accounting for CommonJS. If being loaded as an AMD module, define it as such.\n\t// Otherwise, just add `accounting` to the global object\n\tif (typeof exports !== 'undefined') {\n\t\tif (typeof module !== 'undefined' && module.exports) {\n\t\t\texports = module.exports = lib;\n\t\t}\n\t\texports.accounting = lib;\n\t} else if (typeof define === 'function' && define.amd) {\n\t\t// Return the library as an AMD module:\n\t\tdefine([], function() {\n\t\t\treturn lib;\n\t\t});\n\t} else {\n\t\t// Use accounting.noConflict to restore `accounting` back to its original value.\n\t\t// Returns a reference to the library's `accounting` object;\n\t\t// e.g. `var numbers = accounting.noConflict();`\n\t\tlib.noConflict = (function(oldAccounting) {\n\t\t\treturn function() {\n\t\t\t\t// Reset the value of the root's `accounting` variable:\n\t\t\t\troot.accounting = oldAccounting;\n\t\t\t\t// Delete the noConflict method:\n\t\t\t\tlib.noConflict = undefined;\n\t\t\t\t// Return reference to the library to re-assign it:\n\t\t\t\treturn lib;\n\t\t\t};\n\t\t})(root.accounting);\n\n\t\t// Declare `fx` on the root (global/window) object:\n\t\troot['accounting'] = lib;\n\t}\n\n\t// Root will be `window` in browser or `global` on the server:\n}(this));\n"],"sourceRoot":""}