{"version":3,"sources":["../../src/core/module.js","../../src/core/config/Mathtruncpolyfill.js","../../src/core/config/qallsettled.js","../../src/core/constants/GeneralNoteTypeKeys.js","../../src/core/constants/MedicationHistoryFilterSubtype.js","../../src/core/constants/NumeralConstant.js","../../src/core/constants/PrmState.js","../../src/core/filters/apExprFilter.js","../../src/core/filters/formatNum.js","../../src/core/filters/hasKeys.js","../../src/core/filters/hasNoKeys.js","../../src/core/services/AprimaCache.js","../../src/core/services/BrowserService.js","../../src/core/services/DeviceSettings.js","../../src/core/services/Guid.js","../../src/core/services/NumUtil.js","../../src/core/services/ObjUtil.js","../../src/core/services/SingleAccessSet.js","../../src/core/services/StrConvert.js","../../src/core/services/StringBuilder.js","../../src/core/services/UnitConvert.js"],"names":["angular","module","Math","isFinite","config","trunc","v","window","$provide","decorator","$delegate","$q","allSettled","promises","wrapped","isArray","forEach","promise","key","hasOwnProperty","when","then","value","state","reason","wrap","all","Object","generalNoteTypeKeys","readonlyProp","val","writable","enumerable","configurable","defineProperties","DrugScreeningOverrideReason","MedicationConsent","SigPharmacyInstructions","SigInternalNotes","MedicalDeviceHistoryNotes","DrugDiscontinueOverrideReason","DrugReactionReason","RxChangeMessageResponseComment","constant","Default","Rx","numeral","Fnc","HxTab","RxTab","History","Patient","Medication","Message","ManualRxRefill","filter","$parse","_","parsedExpression","locals","expressionDefinition","arguments","tail","index","isObject","assign","apply","NumUtil","format","input","keys","length","hasKeys","httpLogPrefix","cacheId","obj","methodName","provider","disableAllCaches","cacheSettings","Lists","maxAge","deleteOnExpire","capacity","description","Permissions","ImoTerms","storageMode","ImoDetails","this","addCache","cacheSetting","disableAll","$get","$log","CacheFactory","ObjUtil","caches","mapValues","settings","cacheName","newCache","createNew","defineStaticProps","createNewOverride","createNewClean","getOrCreate","getOrCreateOverride","getOrCreateClean","get","info","keySet","destroy","destroyAll","clearAll","enableAll","touchAll","removeExpiredFromAll","cache","disable","options","createCache","infoFn","infoFnResult","getClone","getFnResult","clone","cloneDeep","addHttpModes","httpSubset","getWithHttpLogging","put","remove","removeAll","httpIgnoreSubset","defaults","getIgnoreCacheWithHttpLogging","defineReadonlyProps","httpMode","httpIgnoreMode","url","result","isDefined","msg","debug","factory","$window","DeviceSettings","ie","navigator","userAgent","match","ie11","ieEDGE","ieVer","base64ToBlob","base64String","contentType","byteCharacters","atob","byteArray","Array","i","charCodeAt","byteArrayInt","Uint8Array","Blob","type","isBlobCompatible","isIE","saveBlob","document","blobObj","fileName","msSaveBlob","downloadLink","createElement","download","href","URL","createObjectURL","onclick","e","body","removeChild","target","style","display","appendChild","click","downloadDocumentToFile","fileNameToSaveAs","isLegacyIE","supportsInlinePdf","isIos","isAndroid","DeviceSettingsFactory","DeviceSettingsRepository","Guid","newGuid","replace","c","r","random","toString","empty","zeroToEmptyRegex","numeraljsFilter","test","multiply","reduce","cumulative","num","divide","num1","num2","add","subtract","propertiesObj","Error","properties","SingleAccessSet","set","prototype","contains","exists","replaceNewLine","str","newVal","oldVal","isString","valToReplace","isNil","replacement","defineProperty","init","initialStr","StringBuilder","self","baseStr","Append","AppendLine","isNaN","ToString","floor","pow","usToKg","convertUsToKg","usToKgRounded","lbs","oz","roundKg","usToCm","convertUsToCm","usToCmRounded","ft","inches","roundCm","kgToUs","convertKgToUs","kgToUsRounded","kg","usMeasurements","ounces","round","cmToUs","convertCmToUs","cmToUsRounded","cm","getBodySurfaceArea","heightCm","weightKg","totalKg","roundedKg","totalCm","roundedCm","totalPounds","pounds","totalFeet","feet"],"mappings":"AAAAA,QAAQC,OAAO,cAAe,CAC1B,SACA,gBACA,gBCHJ,SAAUD,QAASE,KAAMC,UACrB,aAKAH,QAAQC,OAAO,eAAeG,OAAO,CAIrC,WACSF,KAAKG,QACNH,KAAKG,MAAQ,SAASC,GAElB,OAAKH,SADLG,GAAKA,GAGGA,EAAIA,EAAI,IAAWA,EAAI,GAAK,EAAU,IAANA,EAAUA,EAAI,GAF7BA,OAdzC,CAiCGC,OAAOP,QAASO,OAAOL,KAAMK,OA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I,GAtFd,GAuFV,OAAOO,UAGX,SAAShB,cAAcE,IACnB,IAAIe,YAAcjN,QAAQ8I,SAAUoD,IAAM,EAxE1B,cAyEZZ,IAAML,MAAMgC,aACZ1B,GAAKvL,QAAQ8I,SAAS9I,QAAQsJ,SAAS2D,YAAa3B,KAxExC,IA0EZ5G,OAAS,CACTwI,OAAQ5B,IACRc,OAAQb,IAGZ,OAAO7G,OASX,SAAS6H,cAAcE,IACnB,IAAIU,UAAYnN,QAAQ8I,SAAU2D,IAAM,EAjFzB,YAkFXb,GAAKX,MAAMkC,WACXtB,OAAS7L,QAAQ8I,SAAS9I,QAAQsJ,SAAS6D,UAAWvB,IAjF3C,IAmFXlH,OAAS,CACT0I,KAAMxB,GACNC,OAAQA,QAGZ,OAAOnH,WAzInB,CA8JGtI,OAAOP,QAASO,OAAOL,KAAKkP,MAAO7O,OAAOL,KAAKmP","file":"aprima-core.min.js","sourcesContent":["angular.module('aprima-core', [\r\n    'lodash', \r\n    'angular-cache',\r\n    'ngNumeraljs',\r\n]);\r\n","(function(angular, Math, isFinite) {\r\n    'use strict';\r\n\r\n    // according to https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/trunc\r\n    // ie doesn't support Math.trunc(), so this is a polyfill for it; it's listed at the bottom of the linked page\r\n    \r\n    angular.module('aprima-core').config([\r\n        MathTruncPolyfill,\r\n    ]);\r\n\r\n    function MathTruncPolyfill() {\r\n        if (!Math.trunc) {\r\n            Math.trunc = function(v) {\r\n                v = +v;\r\n                if (!isFinite(v)) return v;\r\n\r\n                return (v - v % 1)   ||   (v < 0 ? -0 : v === 0 ? v : 0);\r\n\r\n                // returns:\r\n                //  0        ->  0\r\n                // -0        -> -0\r\n                //  0.2      ->  0\r\n                // -0.2      -> -0\r\n                //  0.7      ->  0\r\n                // -0.7      -> -0\r\n                //  Infinity ->  Infinity\r\n                // -Infinity -> -Infinity\r\n                //  NaN      ->  NaN\r\n                //  null     ->  0\r\n            };\r\n        }\r\n    }\r\n    \r\n})(window.angular, window.Math, window.isFinite);\r\n","(function(angular) {\r\n    'use strict';\r\n\r\n    angular.module('aprima-core').config([\r\n        '$provide',\r\n        QAllSettled,\r\n    ]);\r\n\r\n    function QAllSettled($provide) {\r\n        // https://stackoverflow.com/questions/18888104/angularjs-q-wait-for-all-even-when-1-rejected\r\n        $provide.decorator('$q', [\r\n            '$delegate',\r\n            addAllSettled,\r\n        ]);\r\n\r\n        function addAllSettled($delegate) {\r\n            var $q = $delegate;\r\n\r\n            $q.allSettled = $q.allSettled || allSettled;\r\n\r\n            return $q;\r\n\r\n            function allSettled(promises) {\r\n                // Implementation of allSettled function from Kris Kowal's Q:\r\n                // https://github.com/kriskowal/q/wiki/API-Reference#promiseallsettled\r\n\r\n                var wrapped = angular.isArray(promises) ? [] : {};\r\n\r\n                angular.forEach(promises, function(promise, key) {\r\n                    if (!wrapped.hasOwnProperty(key)) {\r\n                        wrapped[key] = wrap(promise);\r\n                    }\r\n                });\r\n\r\n                return $q.all(wrapped);\r\n            }\r\n\r\n            function wrap(promise) {\r\n                return $q.when(promise)\r\n                    .then(function (value) {\r\n                        return { state: 'fulfilled', value: value };\r\n                    }, function (reason) {\r\n                        return { state: 'rejected', reason: reason };\r\n                    });\r\n            }\r\n        }\r\n    }\r\n})(window.angular);","(function(angular, Object) {\r\n    'use strict';\r\n\r\n    // Add to this as necessary\r\n    var generalNoteTypeKeys = {};\r\n    Object.defineProperties(generalNoteTypeKeys, {\r\n        DrugScreeningOverrideReason: readonlyProp('Medication_Override'),\r\n        MedicationConsent: readonlyProp('MedicationConsent'),\r\n        SigPharmacyInstructions: readonlyProp('Sig_Item'),\r\n        SigInternalNotes: readonlyProp('SigInternal'),\r\n        MedicalDeviceHistoryNotes: readonlyProp('MEDICALDEVICE-HISTORY'),\r\n        DrugDiscontinueOverrideReason: readonlyProp('RX_Discontinue'),\r\n        DrugReactionReason: readonlyProp('DrugReaction'),\r\n        RxChangeMessageResponseComment:readonlyProp('RXChangeResponseComment'),\r\n    });\r\n\r\n    function readonlyProp(val) {\r\n        return {\r\n            value: val,\r\n            writable: false,\r\n            enumerable: true,\r\n            configurable: false,\r\n        };\r\n    }\r\n\r\n    angular.module('aprima-core').constant('GeneralNoteTypeKeys', generalNoteTypeKeys);\r\n\r\n})(window.angular, window.Object);\r\n","    angular.module('aprima-core').constant('MedicationHistoryFilterSubtype', {\r\n        Default: 0,\r\n        Rx: 1        \r\n    });\r\n\r\n","(function(angular, numeral) {\r\n    'use strict';\r\n\r\n    angular.module('aprima-core').constant('numeral', numeral);\r\n\r\n})(window.angular, window.numeral);\r\n","    angular.module('aprima-core').constant('PrmState', {\r\n        Fnc: {\r\n                HxTab: 'HxTab',\r\n                RxTab: 'RxTab',\r\n            },\r\n        History: {\r\n            Patient: {\r\n                Medication: 'PatientMedicationHistory'\r\n            }\r\n        },\r\n        Message: {\r\n            ManualRxRefill: 'ManualRxRefillMessage'\r\n        }\r\n    });\r\n\r\n","// Filter that allows angular expressions and has lodash(_) in its context\r\n\r\n// It converts angular expression to a function, \r\n// and then delegates to the default angular 'filter' with this function\r\n\r\n// Usage: \r\n// $scope.items = [{a: 1}, {a: {b: 1}}, {a: {b: 2}}, {a: 2}, {a: 3}];\r\n// $scope.scopeValue = 2;\r\n// ng-repeat=\"item in items | apExprFilter:'!_.isObject($exprItem.a)'\"\r\n// => [{a: 1}, {a: 2}, {a: 3}]\r\n// ng-repeat=\"item in items | apExprFilter:'_.isObject($exprItem.a)'\"\r\n// => [{a: {b: 1}}, {a: {b: 2}}]\r\n\r\n// Parameterized (because this filter doesn't know anything about the scope, and it shouldn't, but if we pass values in, then it can use those):\r\n// Array:\r\n// $0, $1, $2, etc. are locals to the expression that correspond to the other values in the array in order\r\n// ng-repeat=\"item in items | apExprFilter:['$exprItem.a === $0', scopeValue]\"\r\n// => '$exprItem.a === 2'\r\n// => [{a: 2}]\r\n// Object:\r\n// the expression should be expr property of object, the other properties become locals to the expression\r\n// ng-repeat=\"item in items | apExprFilter:{expr: '$exprItem.a === someProperty', someProperty: scopeValue}\"\r\n// => '$exprItem.a === 2'\r\n// => [{a: 2}]\r\n\r\nangular.module('aprima-core').filter('apExprFilter', ['filterFilter', '$parse', '_', function(filter, $parse, _) {\r\n    'use strict';\r\n\r\n    var localKeyPrefix = '$';\r\n    var localItemKey = '$exprItem';\r\n    var exprKey = 'expr';\r\n\r\n    return _filter;\r\n\r\n    function _filter() {\r\n        var locals = {\r\n            _: _\r\n        };\r\n        var expressionDefinition = arguments[1];\r\n        var parsedExpression;\r\n\r\n        if(_.isArray(expressionDefinition)) {\r\n            parsedExpression = $parse(expressionDefinition[0]);\r\n            _(expressionDefinition).tail().forEach(function(value, index) {\r\n                locals[localKeyPrefix + index] = value;\r\n            });\r\n        }\r\n        else if(_.isObject(expressionDefinition)) {\r\n            parsedExpression = $parse(expressionDefinition[exprKey]);\r\n            delete expressionDefinition[exprKey];\r\n            _.assign(locals, expressionDefinition);\r\n        }\r\n        else {\r\n            parsedExpression = $parse(expressionDefinition);\r\n        }\r\n\r\n        arguments[1] = filterExpression;\r\n        return filter.apply(null, arguments);\r\n\r\n        function filterExpression(value) {\r\n            locals[localItemKey] = value;\r\n            return parsedExpression(locals);\r\n        }\r\n    }\r\n}]);\r\n","(function(angular) {\r\n    'use strict';\r\n\r\n    angular.module('aprima-core').filter('formatNum', [\r\n        'NumUtil',\r\n        formatNum,\r\n    ]);\r\n\r\n    function formatNum(\r\n        NumUtil\r\n    ) {\r\n        return NumUtil.format;\r\n    }\r\n\r\n})(window.angular);\r\n","(function(angular) {\r\n    'use strict';\r\n\r\n    angular.module('aprima-core').filter('hasKeys', [\r\n        '_',\r\n        hasKeysFactory,\r\n    ]);\r\n\r\n    function hasKeysFactory(\r\n        _\r\n    ) {\r\n\r\n        return hasKeys;\r\n\r\n\r\n        function hasKeys(input) {\r\n            var keys = _.keys(input);\r\n            return keys && keys.length;\r\n        }\r\n    }\r\n\r\n})(window.angular);","(function(angular) {\r\n    'use strict';\r\n\r\n    angular.module('aprima-core').filter('hasNoKeys', [\r\n        'hasKeysFilter',\r\n        hasNoKeysFactory,\r\n    ]);\r\n\r\n    function hasNoKeysFactory(\r\n        hasKeys\r\n    ) {\r\n\r\n        return hasNoKeys;\r\n\r\n\r\n        function hasNoKeys(input) {\r\n            var result = !hasKeys(input);\r\n            return result;\r\n        }\r\n    }\r\n\r\n})(window.angular);","// If you want to configure one of these caches to be different than what is set here\r\n// then do something like this example in your root project:\r\n// angular.module('module-name').run(['AprimaCache', function(AprimaCache) {\r\n//     'use strict';\r\n//     AprimaCache.Lists.setMaxAge(10 * 60 * 1000);\r\n// }]);\r\n// Or to add another cache or even change a common one from your root project:\r\n// angular.module('module-name').config(['AprimaCacheProvider', function(AprimaCacheProvider) {\r\n//     'use strict';\r\n//     AprimaCacheProvider.addCache({\r\n//         Default: {\r\n//             maxAge: 5 * 60 * 1000,\r\n//             deleteOnExpire: 'aggressive'\r\n//         },\r\n//         NewCache: {\r\n//             maxAge: 10 * 60 * 1000,\r\n//             deleteOnExpire: 'passive'\r\n//         },\r\n//         NewCache2: {\r\n//             maxAge: 10 * 60 * 1000,\r\n//             deleteOnExpire: 'passive'\r\n//         }\r\n//     });\r\n// }]);\r\n// Here is the API for CacheFactory: https://github.com/jmdobry/angular-cache#api-reference\r\n\r\n// One of the reasons this is necessary is because sometimes it is useful to have more control over the caching,\r\n// and because iOS doesn't handle Cache-Control headers correctly\r\n\r\n(function(angular) {\r\n    'use strict';\r\n\r\n    angular.module('aprima-core').provider('AprimaCache', [\r\n        '_',\r\n        AprimaCacheProvider,\r\n    ]);\r\n\r\n    function AprimaCacheProvider(\r\n        _\r\n    ) {\r\n        var disableAllCaches = false;\r\n\r\n        // IMPORTANT:\r\n        // Using localStorage or sessionStorage for storageMode doesn't work right with promises,\r\n        // because of a bug where the item never gets removed from storage\r\n        // even after it's supposed to be expired (https://github.com/jmdobry/angular-cache/issues/224)\r\n\r\n        // These caches are global, so if you change one, it will be changed for everywhere that uses it\r\n        // These below are the common ones\r\n        var cacheSettings = {\r\n            // cache to be used for lists\r\n            Lists: {\r\n                maxAge: 1 * 60 * 60 * 1000, // 60 minutes (1 hour)\r\n                deleteOnExpire: 'passive',\r\n                capacity: 200,\r\n                description: 'All Lists',\r\n            },\r\n            // default http cache\r\n            Default: {\r\n                maxAge: 2 * 60 * 60 * 1000, // 2 hours\r\n                deleteOnExpire: 'passive',\r\n                capacity: 200,\r\n                description: 'General Data Cache',\r\n            },\r\n            Permissions: {\r\n                maxAge: 30 * 60 * 1000, // 30 minutes\r\n                deleteOnExpire: 'passive',\r\n                capacity: 100,\r\n                description: 'Security Permissions',\r\n            },\r\n\r\n            // I don't believe any IMO data will change more than once per day (24 hours)\r\n            ImoTerms: {\r\n                maxAge: 24 * 60 * 60 * 1000, // 24 hours\r\n                deleteOnExpire: 'passive',\r\n                storageMode: 'localStorage',\r\n                capacity: 200,\r\n                description: 'Diagnosis Terms',\r\n            },\r\n            ImoDetails: {\r\n                maxAge: 24 * 60 * 60 * 1000, // 24 hours\r\n                deleteOnExpire: 'passive',\r\n                storageMode: 'localStorage',\r\n                capacity: 100,\r\n                description: 'Diagnosis Details',\r\n            }\r\n        };\r\n\r\n        // cacheSetting should be like { cacheName: { maxAge: x, .....}}\r\n        this.addCache = addCache;\r\n\r\n        // can disable all of these caches completely in config block at the start of the app if needed\r\n        this.disableAll = disableAll;\r\n\r\n        this.$get = [\r\n            '_',\r\n            '$log',\r\n            'CacheFactory',\r\n            'ObjUtil',\r\n            AprimaCacheService,\r\n        ];\r\n\r\n        function addCache(cacheSetting) {\r\n            _.assign(cacheSettings, cacheSetting);\r\n        }\r\n\r\n        function disableAll() {\r\n            disableAllCaches = true;\r\n        }\r\n\r\n        function AprimaCacheService(\r\n            _,\r\n            $log,\r\n            CacheFactory,\r\n            ObjUtil\r\n        ) {\r\n            // if the CacheFactory api changes, then the CacheFactoryDecorator needs to be updated as well\r\n\r\n            var caches = _.mapValues(cacheSettings, function(settings, cacheName) {\r\n                var newCache = createNew(cacheName, settings);\r\n                return newCache;\r\n            });\r\n\r\n            ObjUtil.defineStaticProps(caches, {\r\n                createNew: createNew,\r\n                // these 2 override methods are for when you want to get a cache that won't be\r\n                // automatically disabled based on AprimaCacheProvider.disableAll();\r\n                createNewOverride: createNewClean,\r\n                getOrCreate: getOrCreate,\r\n                getOrCreateOverride: getOrCreateClean,\r\n                get: get,\r\n                info: info,\r\n                keySet: keySet,\r\n                keys: keys,\r\n                destroy: destroy,\r\n                destroyAll: destroyAll,\r\n                clearAll: clearAll,\r\n                enableAll: enableAll,\r\n                disableAll: disableAll,\r\n                touchAll: touchAll,\r\n                removeExpiredFromAll: removeExpiredFromAll,\r\n            });\r\n\r\n            return caches;\r\n\r\n\r\n            function createNew() {\r\n                var cache = createNewClean.apply(null, arguments);\r\n                if(disableAllCaches) {\r\n                    cache.disable();\r\n                }\r\n                return cache;\r\n            }\r\n\r\n            function createNewClean(cacheName, options) {\r\n                CacheFactory.destroy(cacheName);\r\n                var cache = CacheFactory.createCache.apply(CacheFactory, arguments);\r\n\r\n                // This code below used to be in a decorator of CacheFactory,\r\n                // but because CacheFactory is defined as a singleton outside of angular,\r\n                // the singleton is not re-created each time the modules are reloaded.\r\n                // Because of this, making changes to methods on the singleton was causing issues in the unit tests,\r\n                // since those changes were persisting between tests.\r\n                // That is why it was just simply moved to this wrapper service.\r\n                var description = options && options.description || cacheName;\r\n\r\n                var infoFn = cache.info;\r\n                cache.info = function() {\r\n                    var infoFnResult = infoFn.apply(cache, arguments);\r\n                    if(infoFnResult) {\r\n                        infoFnResult.description = description;\r\n                    }\r\n                    return infoFnResult;\r\n                };\r\n\r\n                cache.getClone = function() {\r\n                    var getFnResult = cache.get.apply(cache, arguments);\r\n                    var clone = _.cloneDeep(getFnResult);\r\n                    return clone;\r\n                };\r\n\r\n                addHttpModes(cache, cacheName);\r\n\r\n                return cache;\r\n            }\r\n\r\n            function getOrCreate() {\r\n                var cache = getOrCreateClean.apply(null, arguments);\r\n                if(disableAllCaches) {\r\n                    cache.disable();\r\n                }\r\n                return cache;\r\n            }\r\n\r\n            function getOrCreateClean(cacheName) {\r\n                var cache = CacheFactory.get(cacheName) || createNewClean(cacheName);\r\n                return cache;\r\n            }\r\n\r\n            function get() {\r\n                return CacheFactory.get.apply(CacheFactory, arguments);\r\n            }\r\n\r\n            function info() {\r\n                return CacheFactory.info.apply(CacheFactory, arguments);\r\n            }\r\n\r\n            function keySet() {\r\n                return CacheFactory.keySet.apply(CacheFactory, arguments);\r\n            }\r\n\r\n            function keys() {\r\n                return CacheFactory.keys.apply(CacheFactory, arguments);\r\n            }\r\n\r\n            function destroy() {\r\n                return CacheFactory.destroy.apply(CacheFactory, arguments);\r\n            }\r\n\r\n            function destroyAll() {\r\n                return CacheFactory.destroyAll.apply(CacheFactory, arguments);\r\n            }\r\n\r\n            function clearAll() {\r\n                return CacheFactory.clearAll.apply(CacheFactory, arguments);\r\n            }\r\n\r\n            function enableAll() {\r\n                return CacheFactory.enableAll.apply(CacheFactory, arguments);\r\n            }\r\n\r\n            function disableAll() {\r\n                return CacheFactory.disableAll.apply(CacheFactory, arguments);\r\n            }\r\n\r\n            function touchAll() {\r\n                return CacheFactory.touchAll.apply(CacheFactory, arguments);\r\n            }\r\n\r\n            function removeExpiredFromAll() {\r\n                return CacheFactory.removeExpiredFromAll.apply(CacheFactory, arguments);\r\n            }\r\n\r\n\r\n            // adds httpMode and httpIgnoreMode properties to the cache\r\n            // that will add more logging when passing in to restangular and/or $http\r\n            function addHttpModes(cache, cacheName) {\r\n                if (!cache) {\r\n                    return;\r\n                }\r\n\r\n                var httpSubset = {\r\n                    get: getWithHttpLogging,\r\n                    put: wrap(cache, 'put'),\r\n                    remove: wrap(cache, 'remove'),\r\n                    removeAll: wrap(cache, 'removeAll'),\r\n                    info: wrap(cache, 'info'),\r\n                    destroy: wrap(cache, 'destroy'),\r\n                };\r\n\r\n                var httpIgnoreSubset = _.defaults({\r\n                    get: getIgnoreCacheWithHttpLogging,\r\n                }, httpSubset);\r\n\r\n\r\n                // pass these into $http or restangular, instead of just the normal cache object\r\n                ObjUtil.defineReadonlyProps(cache, {\r\n                    httpMode: httpSubset,\r\n                    httpIgnoreMode: httpIgnoreSubset,\r\n                });\r\n\r\n                return cache;\r\n\r\n                // adds logging for when it is using a cached value\r\n                function getWithHttpLogging(url) {\r\n                    var result = cache.get.apply(cache, arguments);\r\n                    if(angular.isDefined(result)) {\r\n                        var msg = _.isArray(result) ? '($http format: [statusCode, data, headers, statusText])' : '';\r\n\r\n                        $log.debug(httpLogPrefix(cacheName), '-- Retrieved \"' + url + '\" from cache. Result' + msg + ':', result);\r\n                    }\r\n\r\n                    return result;\r\n                }\r\n\r\n                // have $http ignore the cached value by just returning undefined instead\r\n                // and log when a value is ignored\r\n                function getIgnoreCacheWithHttpLogging(url) {\r\n                    $log.debug(httpLogPrefix(cacheName), '-- Ignored cache for \"' + url + '\".');\r\n                    return undefined;\r\n                }\r\n            }\r\n        }\r\n    }\r\n\r\n    function httpLogPrefix(cacheId) {\r\n        return 'AprimaCache-' + cacheId + '-Http';\r\n    }\r\n\r\n    function wrap(obj, methodName) {\r\n        return function() {\r\n            return obj[methodName].apply(obj, arguments);\r\n        };\r\n    }\r\n\r\n})(window.angular);\r\n","angular.module('aprima-core').factory('BrowserService',\r\n    [\r\n        '$window',\r\n         '$log',\r\n         'DeviceSettings', \r\n    function (\r\n        $window, \r\n        $log,\r\n        DeviceSettings\r\n    ) {\r\n        'use strict';\r\n\r\n        var ie = navigator.userAgent.match(/MSIE\\s([\\d.]+)/),\r\n            ie11 = navigator.userAgent.match(/Trident\\/7.0/) && navigator.userAgent.match(/rv:11/),\r\n            ieEDGE = navigator.userAgent.match(/Edge/g),\r\n            ieVer = (ie ? ie[1] : (ie11 ? 11 : (ieEDGE ? 12 : -1)));\r\n\r\n        function base64ToBlob(base64String, contentType){\r\n            var byteCharacters = atob(base64String);\r\n            var byteArray = new Array(byteCharacters.length);\r\n\r\n            for (var i = 0; i < byteCharacters.length; i++) {\r\n                byteArray[i] = byteCharacters.charCodeAt(i);\r\n            }\r\n            var byteArrayInt = new Uint8Array(byteArray);\r\n\r\n            return new Blob([byteArrayInt], {type: contentType});\r\n        }\r\n\r\n        function downloadDocumentToFile(fileNameToSaveAs, base64String, contentType, document){\r\n            if (!isBlobCompatible()) {\r\n                return;\r\n            }\r\n\r\n            var blob = base64ToBlob(base64String, contentType);\r\n            saveBlob(document, blob, fileNameToSaveAs);\r\n        }\r\n\r\n        function isBlobCompatible(){\r\n            if (ie && ieVer<10) {\r\n                $log('No blobs on IE ver<10');\r\n                return false;\r\n            }\r\n            return true;\r\n        }\r\n\r\n        function isLegacyIE() {\r\n            return !!(ie || ie11);\r\n        }\r\n\r\n        function isIE(){\r\n            return !!(ie || ie11 || ieEDGE);\r\n        }\r\n\r\n        function saveBlob(document, blobObj, fileName) {\r\n            if (ieVer > -1) {\r\n                $window.navigator.msSaveBlob(blobObj, fileName);\r\n\r\n            } else {\r\n                var downloadLink = document.createElement('a');\r\n                downloadLink.download = fileName;\r\n                downloadLink.href = $window.URL.createObjectURL(blobObj);\r\n                downloadLink.onclick = function (e) {\r\n                    document.body.removeChild(e.target);\r\n                };\r\n                downloadLink.style.display = 'none';\r\n                document.body.appendChild(downloadLink);\r\n                downloadLink.click();\r\n            }\r\n        }\r\n\r\n        function supportsInlinePdf() {\r\n            if (isIE() || DeviceSettings.isIos || DeviceSettings.isAndroid) {\r\n                return false;\r\n            }\r\n            return true;\r\n        }\r\n\r\n        return {\r\n            base64ToBlob : base64ToBlob,\r\n            downloadDocumentToFile : downloadDocumentToFile,\r\n            isBlobCompatible: isBlobCompatible,\r\n            isIE: isIE,\r\n            isLegacyIE: isLegacyIE,\r\n            saveBlob: saveBlob,\r\n            supportsInlinePdf: supportsInlinePdf,\r\n        };\r\n    }\r\n    ]);","(function(angular) {\r\n    'use strict';\r\n\r\n    angular.module('aprima-core').provider('DeviceSettings', [\r\n        DeviceSettingsProvider,\r\n    ]);\r\n\r\n    function DeviceSettingsProvider() {\r\n        return {\r\n            $get: [\r\n                'DeviceSettingsRepository',\r\n                DeviceSettingsFactory,\r\n            ],\r\n        };\r\n    }\r\n\r\n    function DeviceSettingsFactory(DeviceSettingsRepository) {\r\n        return DeviceSettingsRepository;\r\n    }\r\n})(angular);\r\n","angular.module('aprima-core').factory('Guid', [\r\n    function() {\r\n        'use strict';\r\n        var Guid = {};\r\n        Guid.newGuid = function newGuid() {\r\n            return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {\r\n                var r = Math.random() * 16 | 0, v = c === 'x' ? r : (r & 0x3 | 0x8);\r\n                return v.toString(16);\r\n            });\r\n        };\r\n        Guid.empty = function empty() {\r\n            return '00000000-0000-0000-0000-000000000000';\r\n        };\r\n        return Guid;\r\n    }\r\n]);","// This service is an abstraction around the third party numeraljsFilter, \r\n// It is useful in case we want to swap it out with another implementation\r\n\r\n(function(angular) {\r\n    'use strict';\r\n\r\n    // todo: this utility library doesn't handle the optional digit before the decimal point correctly \r\n    // (it always has a digit before the decimal point, even if it's a leading 0)\r\n    // for example:\r\n    // format(0, '[0][.]0') => '0', i would expect ''\r\n    // format(0.56, '[0][.]0') => '0.6', i would expect '.6'\r\n\r\n    // you can get the result without the leading 0, by doing this:\r\n    // format(0, '[.]0') => ''\r\n    // format(0.56, '[.]0') => '.6'\r\n    // these will work as expected,\r\n    // but then problem is this:\r\n    // format(6.56, '[.]0') => '.6', i would expect '6.6'\r\n    // it just never shows anything to the left of the decimal point\\\r\n\r\n    // and it's not trivial to just remove the 0 out of there in this function, since the leading zero could be anywhere in the\r\n    // result string, since it's based on what format was passed in\r\n    // (the format could have a currency symbol or '-' sign at the start of the string, among other things)\r\n    // '0.60' or '-0.60' or '$ 0.60' or '$ -0.60'\r\n    // these 4 examples all have leading zeroes in a different index in the result string\r\n\r\n    // Other Info:\r\n    // ===========\r\n    // c# formats i've seen in our backend codebase:\r\n    // 1. ####.##\r\n    // 2. #.##\r\n    // 3. .##\r\n    // these 3 examples are identical in c#\r\n    // they all would convert to [0].[00] for this numeraljs formatter, which translates to\r\n    // optional digit followed by decimal, and it has a max of 2 optional digits after the decimal point\r\n\r\n    // this regex will handle most or all cases where where it could return '0', when it really should return ''\r\n    // because all digits in the format are optional\r\n    // this is important only because there are certain cases where if a number value is 0, we could check the result\r\n    // to see if it's just an empty string, or if it actually has a value\r\n    // [0] at start, followed by ( ([.] and anything after it) OR .([0*])? )?\r\n    var zeroToEmptyRegex = /^\\[0]((\\[\\.].*)|(\\.(\\[0*])?))?$/;\r\n\r\n    angular.module('aprima-core').factory('NumUtil', [\r\n        '_',\r\n        'numeral',\r\n        'numeraljsFilter',\r\n        NumUtil,\r\n    ]);\r\n\r\n    function NumUtil(\r\n        _,\r\n        numeral,\r\n        numeraljsFilter\r\n    ) {\r\n\r\n        var service = {\r\n            format: format,\r\n            multiply: multiply,\r\n            divide: divide,\r\n            add: add,\r\n            subtract: subtract,\r\n        };\r\n\r\n        return service;\r\n\r\n        function format(input, format) {\r\n            var result = numeraljsFilter(input, format);\r\n            \r\n            // if the regex matches, return empty string ('') instead of '0'\r\n            if(result && result === '0' && zeroToEmptyRegex.test(format)) {\r\n                result = '';\r\n            }\r\n            return result;\r\n        }\r\n\r\n        // precision multiplication, different from just doing num1 * num2\r\n        // check for example 18.7 * 1.5 === 28.049999999999997 vs multiply(18.7, 1.5) === 28.05\r\n        // can pass more than 2 arguments, and they will all be multiplied, ex: multiply(2, 3, 8) === 48\r\n        function multiply() {\r\n            var result = _.reduce(arguments, function(cumulative, num) {\r\n                return cumulative.multiply(num);\r\n            }, numeral(1)).value();\r\n\r\n            return result;\r\n        }\r\n\r\n        // same idea as multiply function => more precise than num1 / num2\r\n        // 6.9 / 3 === 2.3000000000000003 vs divide(6.9, 3) === 2.3\r\n        function divide(num1, num2) {\r\n            var result = numeral(num1).divide(num2).value();\r\n            return result;\r\n        }\r\n\r\n        // same idea as multiply function => more precise than num1 + num2\r\n        // 0.1 + 0.2 === 0.30000000000000004 vs add(0.1, 0.2) === 0.3\r\n        function add() {\r\n            var result = _.reduce(arguments, function(cumulative, num) {\r\n                return cumulative.add(num);\r\n            }, numeral(0)).value();\r\n\r\n            return result;\r\n        }\r\n\r\n        // same idea as multiply function => more precise than num1 - num2\r\n        // 0.1 - 0.3 === -0.19999999999999998 vs subtract(0.1, 0.3) === -0.2\r\n        function subtract(num1, num2) {\r\n            var result = numeral(num1).subtract(num2).value();\r\n            return result;\r\n        }\r\n    }\r\n\r\n})(window.angular);\r\n","(function(angular, defineProperties) {\r\n    'use strict';\r\n\r\n    angular.module('aprima-core').factory('ObjUtil', [\r\n        '_',\r\n        ObjUtil,\r\n    ]);\r\n    \r\n    function ObjUtil(\r\n        _\r\n    ) {\r\n        var service = {\r\n            defineReadonlyProps: defineReadonlyProps,\r\n            defineStaticProps: defineStaticProps,\r\n        };\r\n\r\n        return service;\r\n\r\n        // readonly properties that are enumerable\r\n        function defineReadonlyProps(obj, propertiesObj) {\r\n            if(!_.isObject(propertiesObj)) {\r\n                throw new Error('Expected defineReadonlyProps to be called with object instead of ' + propertiesObj);\r\n            }\r\n\r\n            var properties = _.mapValues(propertiesObj, function(val) {\r\n                return {\r\n                    value: val,\r\n                    writable: false,\r\n                    enumerable: true,\r\n                    configurable: false,\r\n                };\r\n            });\r\n            return defineProperties(obj, properties);\r\n        }\r\n\r\n        // readonly, but not enumerable\r\n        function defineStaticProps(obj, propertiesObj) {\r\n            if(!_.isObject(propertiesObj)) {\r\n                throw new Error('Expected defineStaticProps to be called with object instead of ' + propertiesObj);\r\n            }\r\n\r\n            var properties = _.mapValues(propertiesObj, function(val) {\r\n                return {\r\n                    value: val,\r\n                    writable: false,\r\n                    enumerable: false,\r\n                    configurable: false,\r\n                };\r\n            });\r\n            return defineProperties(obj, properties);\r\n        }\r\n    }\r\n\r\n})(window.angular, window.Object.defineProperties);\r\n","/*\r\nA set that allows adding values and checking if it contains a value. contains() removes the item from the list.\r\n */\r\nangular.module('aprima-core').factory('SingleAccessSet', [function() {\r\n    'use strict';\r\n\r\n    function SingleAccessSet() {\r\n        this.set = {};\r\n    }\r\n\r\n    SingleAccessSet.prototype.add = function add(key) {\r\n        this.set[key] = true;\r\n    };\r\n\r\n    SingleAccessSet.prototype.contains = function contains(key) {\r\n        var exists = !!this.set[key];\r\n        delete this.set[key];\r\n        return exists;\r\n    };\r\n\r\n    return SingleAccessSet;\r\n}]);","(function(angular) {\r\n    'use strict';\r\n\r\n    angular.module('aprima-core').factory('StrConvert', [\r\n        '_',\r\n        StrConvert,\r\n    ]);\r\n\r\n    function StrConvert(\r\n        _\r\n    ) {\r\n\r\n        var service = {\r\n            replaceNewLine: replaceNewLine,\r\n        };\r\n\r\n        return service;\r\n\r\n        function replaceNewLine(str, newVal, oldVal) {\r\n            if(!str || !_.isString(str)) {\r\n                return str;\r\n            }\r\n\r\n            var valToReplace = _.isNil(oldVal) ? /(\\r\\n|\\r|\\n)/g : oldVal;\r\n            var replacement = _.isNil(newVal) ? '<br>' : newVal;\r\n\r\n            var result = str.replace(valToReplace, replacement);\r\n            return result;\r\n        }\r\n    }\r\n})(window.angular);\r\n","(function(angular, defineProperty) {\r\n    'use strict';\r\n\r\n    // similar to c# StringBuilder, but with much less functionality (only a subset of functions)\r\n    // will make it easier to port code from C# to js, if necessary\r\n\r\n    var newLine = '\\r\\n';\r\n\r\n    angular.module('aprima-core').factory('StringBuilder', [\r\n        '_',\r\n        StringBuilderFactory,\r\n    ]);\r\n    \r\n    function StringBuilderFactory(\r\n        _\r\n    ) {\r\n        var service = {\r\n            init: init,\r\n        };\r\n        \r\n        return service;\r\n        \r\n        function init(initialStr) {\r\n            var sb = new StringBuilder(initialStr);\r\n            return sb;\r\n        }\r\n\r\n        function StringBuilder(initialStr) {\r\n            var self = this;\r\n            \r\n            var baseStr = initialStr || '';\r\n\r\n            self.Append = append;\r\n            self.AppendLine = appendLine;\r\n            self.ToString = toString;\r\n            defineProperty(self, 'Length', {\r\n                get: stringLength,\r\n                enumerable: true,\r\n                configurable: false,\r\n            });\r\n            \r\n            function append(str) {\r\n                baseStr += str;\r\n                return self;\r\n            }\r\n\r\n            function appendLine(str) {\r\n                if(!_.isNil(str) && !_.isNaN(str)) {\r\n                    baseStr += str;\r\n                }\r\n                baseStr += newLine;\r\n                return self;\r\n            }\r\n            \r\n            function stringLength() {\r\n                return baseStr.length;\r\n            }\r\n            \r\n            function toString() {\r\n                return baseStr;\r\n            }\r\n        }\r\n    }\r\n\r\n})(window.angular, window.Object.defineProperty);\r\n","(function(angular, floor, pow) {\r\n    'use strict';\r\n\r\n    // in PRM these are the formats for the observation value measurements:\r\n    // (According to FrameworkBO.Util.Observation.ObservationFormatter)\r\n    // ====================================================================\r\n    // 1. public const string MetricWeightMask = \"####0.000\";\r\n    var kgPrecision = 3;\r\n\r\n    // 2. public const string EnglishPoundMask = \"####0.000\";\r\n    // this will always be converted to an integer, because the ounces will have the fractional amount\r\n\r\n    // 3. public const string EnglishOzMask = \"###0.0\";\r\n    // the precision of oz is 1 regardless of this mask declared in PRM, because the conversion code rounds\r\n    // to a precision of 1\r\n    var ozPrecision = 1;\r\n\r\n    // 4. public const string MetricCMMask = \"####0.000\";\r\n    var cmPrecision = 3;\r\n\r\n    // 5. public const string EnglishFeetMask = \"####0\";\r\n    // this will always be converted to an integer, because the inches will have the fractional amount\r\n\r\n    // 6. public const string EnglishInchMask = \"###0.000\";\r\n    // the precision of in is 1 regardless of this mask declared in PRM, because the conversion code rounds\r\n    // to a precision of 1\r\n    var inPrecision = 1;\r\n    // ======================================================================\r\n\r\n\r\n    // Multipliers:\r\n    // 1 lb ~= 0.45359237 kg\r\n    var lbsToKgMultiplier = 0.45359237;\r\n    // 1 oz ~= 0.0283495231 kg\r\n    var ozToKgMultiplier = 0.0283495231;\r\n\r\n    // 1 kg ~= 2.2046226218 lbs\r\n    var kgToLbsMultiplier = 2.2046226218;\r\n    // 1 lb == 16 oz\r\n    var lbsToOzMultiplier = 16;\r\n\r\n    // 1 ft ~= 30.48 cm\r\n    var ftToCmMultiplier = 30.48;\r\n    // 1 in ~= 2.54 cm\r\n    var inToCmMultiplier = 2.54;\r\n\r\n    // 1 cm ~= 0.032808399 ft\r\n    var cmToFtMultiplier = 0.032808399;\r\n    // 1 ft == 12 in\r\n    var ftToInMultiplier = 12;\r\n\r\n    angular.module('aprima-core').factory('UnitConvert', [\r\n        '_',\r\n        'NumUtil',\r\n        UnitConvert,\r\n    ]);\r\n\r\n    function UnitConvert(\r\n        _,\r\n        NumUtil\r\n    ) {\r\n\r\n        var service = {\r\n            usToKg: convertUsToKg,\r\n            usToKgRounded: convertUsToKgRounded,\r\n            roundKg: roundKg,\r\n            usToCm: convertUsToCm,\r\n            usToCmRounded: convertUsToCmRounded,\r\n            roundCm: roundCm,\r\n            kgToUs: convertKgToUs,\r\n            kgToUsRounded: convertKgToUsRounded,\r\n            cmToUs: convertCmToUs,\r\n            cmToUsRounded: convertCmToUsRounded,\r\n            getBodySurfaceArea: getBodySurfaceArea,\r\n        };\r\n\r\n        return service;\r\n\r\n        function convertUsToKg(lbs, oz) {\r\n            var totalKg = NumUtil.add(NumUtil.multiply((lbs || 0), lbsToKgMultiplier), NumUtil.multiply((oz || 0), ozToKgMultiplier));\r\n            return totalKg;\r\n        }\r\n\r\n        function convertUsToKgRounded(lbs, oz) {\r\n            var roundedKg = roundKg(convertUsToKg(lbs, oz));\r\n            return roundedKg;\r\n        }\r\n        \r\n        function roundKg(kg) {\r\n            var roundedKg = _.round(kg, kgPrecision);\r\n            return roundedKg;\r\n        }\r\n\r\n        function convertUsToCm(ft, inches) {\r\n            var totalCm = NumUtil.add(NumUtil.multiply((ft || 0), ftToCmMultiplier), NumUtil.multiply((inches || 0), inToCmMultiplier));\r\n            return totalCm;\r\n        }\r\n\r\n        function convertUsToCmRounded(ft, inches) {\r\n            var roundedCm = roundCm(convertUsToCm(ft, inches));\r\n            return roundedCm;\r\n        }\r\n        \r\n        function roundCm(cm) {\r\n            var roundedCm = _.round(cm, cmPrecision);\r\n            return roundedCm;\r\n        }\r\n\r\n        function convertKgToUs(kg) {\r\n            var totalPounds = NumUtil.multiply((kg || 0), kgToLbsMultiplier);\r\n            var lbs = floor(totalPounds);\r\n            var oz = NumUtil.multiply(NumUtil.subtract(totalPounds, lbs), lbsToOzMultiplier);\r\n\r\n            var result = {\r\n                pounds: lbs,\r\n                ounces: oz,\r\n            };\r\n\r\n            return result;\r\n        }\r\n\r\n        function convertKgToUsRounded(kg) {\r\n            var usMeasurements = convertKgToUs(kg);\r\n            usMeasurements.ounces = _.round(usMeasurements.ounces, ozPrecision);\r\n            return usMeasurements;\r\n        }\r\n\r\n        function convertCmToUs(cm) {\r\n            var totalFeet = NumUtil.multiply((cm || 0), cmToFtMultiplier);\r\n            var ft = floor(totalFeet);\r\n            var inches = NumUtil.multiply(NumUtil.subtract(totalFeet, ft), ftToInMultiplier);\r\n\r\n            var result = {\r\n                feet: ft,\r\n                inches: inches,\r\n            };\r\n\r\n            return result;\r\n        }\r\n\r\n        function convertCmToUsRounded(cm) {\r\n            var usMeasurements = convertCmToUs(cm);\r\n            usMeasurements.inches = _.round(usMeasurements.inches, inPrecision);\r\n            return usMeasurements;\r\n        }\r\n        \r\n        // Returns the body surface area as calculated using the DuBois formula method.\r\n        function getBodySurfaceArea(heightCm, weightKg) {\r\n            if(!heightCm || !weightKg) {\r\n                return 0;\r\n            }\r\n            \r\n            // body surface area = 0.007184 * height(cm) to the 0.725 power * weight(kg) to the 0.425 power.\r\n            var bsa = NumUtil.multiply(0.007184, pow(heightCm, 0.725), pow(weightKg, 0.425));\r\n            return bsa;\r\n        }\r\n    }\r\n\r\n})(window.angular, window.Math.floor, window.Math.pow);\r\n"]}