{"version":3,"file":"creditapp.js","sources":["../../../node_modules/pinia/node_modules/vue-demi/lib/index.mjs","../../../node_modules/pinia/dist/pinia.mjs","../../../node_modules/moment/moment.js","../../../node_modules/moment/locale/es.js","../../../vue-core/classes/Applications/ApplicationsChangeLog.js","../../../vue-core/classes/Applications/ApplicationsPreFilledData.js","../../../vue-core/classes/Localization.js","../../../vue-core/classes/Applications/ApplicationsResidenceStatus.js","../../../vue-core/classes/Applications/ApplicationsResidence.js","../../../vue-core/classes/Applications/ApplicationsBusinessOperator.js","../../../vue-core/classes/Applications/ApplicationsBusinessPrincipal.js","../../../vue-core/classes/Applications/ApplicationsBusinessInfo.js","../../../vue-core/classes/Applications/ApplicationsEmployment.js","../../../vue-core/classes/Applications/ApplicationsNonEmploymentIncome.js","../../../vue-core/classes/FIMenuCustomerIdentification.js","../../../vue-core/classes/Applications/ApplicationsPersonalInfo.js","../../../vue-core/classes/Applications/ApplicationsRebates.js","../../../vue-core/classes/Applications/ApplicationsDataAnswered.js","../../../vue-core/services/maps.js","../../../vue-core/modals/customerApp/modalConfirmCustomerApplicationInfo.vue","../../../vue-core/modals/customerApp/modalCustomerApplicationInfo.vue","../../../node_modules/logrocket/dist/build.umd.js","../../../vue-core/classes/Applications/ApplicationsSettingsAPIs.js","../../../vue-core/helpers/dropdown-helper.js","../../../vue-core/classes/Applications/ApplicationsSettingsDropdowns.js","../../../node_modules/@vuelidate/core/dist/index.mjs","../../../vue-core/modals/customerApp/modalEditApplication.vue","../../../vue-core/classes/Applications/ApplicationsQuestion.js","../../../vue-core/classes/Applications/ApplicationsQuoteAppData.js","../../../vue-core/classes/Applications/ApplicationsSessionLog.js","../../../vue-core/classes/Applications/Application.js","../../../vue-core/helpers/customer-application-helper.ts","../../../vue-core/classes/Customer/CustomerPersonalInfo.ts","../../../vue-core/classes/PlaidIDVOverride.js","../../../vue-core/classes/Customer/CustomerRecord.ts","../../../vue-core/classes/FIMenuCreditReport.js","../../../vue-core/classes/FIMenu/FIMenuCreditPulls.js","../../../vue-core/helpers/Providers/cbc-helper.js","../../../vue-core/classes/Plaid/PlaidGenerateLinkRequest.ts","../../../vue-core/helpers/Providers/plaid-helper.ts","../../../vue-core/classes/CustomerMetadata.ts","../../../vue-core/helpers/idv-helper.ts","../../../vue-core/classes/FIMenuCustomer.js","../../../vue-core/components/InputDate.vue","../../../vue-core/components/IsBusyScreenComponent.vue","../../../vue-core/components/Pill.vue","../../../vue-core/components/Pill.vue","../../../vue-core/components/Panel.vue","../../../vue-core/components/Panel.vue","../../../vue-core/classes/RichTableHeader.js","../../../vue-core/classes/RichTableServerSide.ts","../../../vue-core/components/SearchComponent.vue","../../../vue-core/components/RichTableDataCell.vue","../../../vue-core/components/InputDropdown.vue","../../../vue-core/components/RichTableAutoFilter.vue","../../../vue-core/components/ButtonLoading.vue","../../../vue-core/components/ButtonLoading.vue","../../../node_modules/accounting-js/dist/accounting.es6.js","../../../vue-core/components/private/vue-numeric.vue","../../../vue-core/components/InputNumber.vue","../../../vue-core/components/InputNumber.vue","../../../vue-core/modals/modalRichTableSettings.vue","../../../vue-core/components/RichTable.vue","../../../vue-core/stores/BusinessStore.ts","../../../vue-core/helpers/Customer/customer-helper.ts","../../../vue-core/stores/CustomerApplicationStore.ts","../../../vue-core/stores/CustomerStore.ts","../../../vue-core/stores/UserStore.ts","../../../vue-core/components/InputPhone.vue","../../../customer-app/src/views/CreditAppLegal.vue","../../../customer-app/src/components/customerApp/InputTextbox.vue","../../../customer-app/src/components/customerApp/AutocompleteComponent.vue","../../../customer-app/src/components/customerApp/QuestionAutoComplete.vue","../../../customer-app/src/components/customerApp/InputDropdown.vue","../../../customer-app/src/components/customerApp/QuestionDate.vue","../../../customer-app/src/components/customerApp/QuestionFiller.vue","../../../customer-app/src/components/customerApp/vue-numeric.vue","../../../customer-app/src/components/customerApp/InputCurrency.vue","../../../customer-app/src/components/customerApp/QuestionInputCurrency.vue","../../../customer-app/src/components/customerApp/QuestionInputDropdown.vue","../../../customer-app/src/components/customerApp/QuestionInputMultiAnswer.vue","../../../customer-app/src/components/customerApp/InputNumber.vue","../../../customer-app/src/components/customerApp/QuestionInputNumber.vue","../../../customer-app/src/components/customerApp/InputMasked.vue","../../../customer-app/src/components/customerApp/QuestionInputPhone.vue","../../../customer-app/src/components/customerApp/QuestionInputText.vue","../../../customer-app/src/components/customerApp/QuestionMultiButtons.vue","../../../customer-app/src/components/customerApp/QuestionMultiSelect.vue","../../../customer-app/src/components/customerApp/QuestionPlaidLink.vue","../../../customer-app/src/components/customerApp/QuestionSocial.vue","../../../customer-app/src/components/customerApp/QuestionSummary.vue","../../../customer-app/src/components/customerApp/QuestionTextMessage.vue","../../../customer-app/src/components/customerApp/QuestionYesNo.vue","../../../customer-app/src/views/CreditAppQuestionnaire.vue","../../../customer-app/src/views/CreditAppMain.vue","../../../customer-app/src/components/customerApp/LoginError.vue","../../../customer-app/src/components/customerApp/LoginSuccess.vue","../../../vue-core/modals/modalLegalTerm.vue","../../../customer-app/src/views/CreditAppCreateApplication.vue","../../../vue-core/stores/RedirectStore.ts","../../../vue-core/components/customerPortal/PrimaryButton.vue","../../../vue-core/components/customerPortal/PrimaryButton.vue","../../../customer-app/src/components/customerPortal/reusableComponents/Widget.vue","../../../customer-app/src/components/customerPortal/reusableComponents/Widget.vue","../../../customer-app/src/views/OTPPage.vue"],"sourcesContent":["import * as Vue from 'vue'\n\nvar isVue2 = false\nvar isVue3 = true\nvar Vue2 = undefined\n\nfunction install() {}\n\nexport function set(target, key, val) {\n if (Array.isArray(target)) {\n target.length = Math.max(target.length, key)\n target.splice(key, 1, val)\n return val\n }\n target[key] = val\n return val\n}\n\nexport function del(target, key) {\n if (Array.isArray(target)) {\n target.splice(key, 1)\n return\n }\n delete target[key]\n}\n\nexport * from 'vue'\nexport {\n Vue,\n Vue2,\n isVue2,\n isVue3,\n install,\n}\n","/*!\n * pinia v2.2.6\n * (c) 2024 Eduardo San Martin Morote\n * @license MIT\n */\nimport { hasInjectionContext, inject, toRaw, watch, unref, markRaw, effectScope, ref, isVue2, isRef, isReactive, set, getCurrentScope, onScopeDispose, getCurrentInstance, reactive, toRef, del, nextTick, computed, toRefs } from 'vue-demi';\nimport { setupDevtoolsPlugin } from '@vue/devtools-api';\n\n/**\n * setActivePinia must be called to handle SSR at the top of functions like\n * `fetch`, `setup`, `serverPrefetch` and others\n */\nlet activePinia;\n/**\n * Sets or unsets the active pinia. Used in SSR and internally when calling\n * actions and getters\n *\n * @param pinia - Pinia instance\n */\n// @ts-expect-error: cannot constrain the type of the return\nconst setActivePinia = (pinia) => (activePinia = pinia);\n/**\n * Get the currently active pinia if there is any.\n */\nconst getActivePinia = () => (hasInjectionContext() && inject(piniaSymbol)) || activePinia;\nconst piniaSymbol = ((process.env.NODE_ENV !== 'production') ? Symbol('pinia') : /* istanbul ignore next */ Symbol());\n\nfunction isPlainObject(\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\no) {\n return (o &&\n typeof o === 'object' &&\n Object.prototype.toString.call(o) === '[object Object]' &&\n typeof o.toJSON !== 'function');\n}\n// type DeepReadonly = { readonly [P in keyof T]: DeepReadonly }\n// TODO: can we change these to numbers?\n/**\n * Possible types for SubscriptionCallback\n */\nvar MutationType;\n(function (MutationType) {\n /**\n * Direct mutation of the state:\n *\n * - `store.name = 'new name'`\n * - `store.$state.name = 'new name'`\n * - `store.list.push('new item')`\n */\n MutationType[\"direct\"] = \"direct\";\n /**\n * Mutated the state with `$patch` and an object\n *\n * - `store.$patch({ name: 'newName' })`\n */\n MutationType[\"patchObject\"] = \"patch object\";\n /**\n * Mutated the state with `$patch` and a function\n *\n * - `store.$patch(state => state.name = 'newName')`\n */\n MutationType[\"patchFunction\"] = \"patch function\";\n // maybe reset? for $state = {} and $reset\n})(MutationType || (MutationType = {}));\n\nconst IS_CLIENT = typeof window !== 'undefined';\n\n/*\n * FileSaver.js A saveAs() FileSaver implementation.\n *\n * Originally by Eli Grey, adapted as an ESM module by Eduardo San Martin\n * Morote.\n *\n * License : MIT\n */\n// The one and only way of getting global scope in all environments\n// https://stackoverflow.com/q/3277182/1008999\nconst _global = /*#__PURE__*/ (() => typeof window === 'object' && window.window === window\n ? window\n : typeof self === 'object' && self.self === self\n ? self\n : typeof global === 'object' && global.global === global\n ? global\n : typeof globalThis === 'object'\n ? globalThis\n : { HTMLElement: null })();\nfunction bom(blob, { autoBom = false } = {}) {\n // prepend BOM for UTF-8 XML and text/* types (including HTML)\n // note: your browser will automatically convert UTF-16 U+FEFF to EF BB BF\n if (autoBom &&\n /^\\s*(?:text\\/\\S*|application\\/xml|\\S*\\/\\S*\\+xml)\\s*;.*charset\\s*=\\s*utf-8/i.test(blob.type)) {\n return new Blob([String.fromCharCode(0xfeff), blob], { type: blob.type });\n }\n return blob;\n}\nfunction download(url, name, opts) {\n const xhr = new XMLHttpRequest();\n xhr.open('GET', url);\n xhr.responseType = 'blob';\n xhr.onload = function () {\n saveAs(xhr.response, name, opts);\n };\n xhr.onerror = function () {\n console.error('could not download file');\n };\n xhr.send();\n}\nfunction corsEnabled(url) {\n const xhr = new XMLHttpRequest();\n // use sync to avoid popup blocker\n xhr.open('HEAD', url, false);\n try {\n xhr.send();\n }\n catch (e) { }\n return xhr.status >= 200 && xhr.status <= 299;\n}\n// `a.click()` doesn't work for all browsers (#465)\nfunction click(node) {\n try {\n node.dispatchEvent(new MouseEvent('click'));\n }\n catch (e) {\n const evt = document.createEvent('MouseEvents');\n evt.initMouseEvent('click', true, true, window, 0, 0, 0, 80, 20, false, false, false, false, 0, null);\n node.dispatchEvent(evt);\n }\n}\nconst _navigator = typeof navigator === 'object' ? navigator : { userAgent: '' };\n// Detect WebView inside a native macOS app by ruling out all browsers\n// We just need to check for 'Safari' because all other browsers (besides Firefox) include that too\n// https://www.whatismybrowser.com/guides/the-latest-user-agent/macos\nconst isMacOSWebView = /*#__PURE__*/ (() => /Macintosh/.test(_navigator.userAgent) &&\n /AppleWebKit/.test(_navigator.userAgent) &&\n !/Safari/.test(_navigator.userAgent))();\nconst saveAs = !IS_CLIENT\n ? () => { } // noop\n : // Use download attribute first if possible (#193 Lumia mobile) unless this is a macOS WebView or mini program\n typeof HTMLAnchorElement !== 'undefined' &&\n 'download' in HTMLAnchorElement.prototype &&\n !isMacOSWebView\n ? downloadSaveAs\n : // Use msSaveOrOpenBlob as a second approach\n 'msSaveOrOpenBlob' in _navigator\n ? msSaveAs\n : // Fallback to using FileReader and a popup\n fileSaverSaveAs;\nfunction downloadSaveAs(blob, name = 'download', opts) {\n const a = document.createElement('a');\n a.download = name;\n a.rel = 'noopener'; // tabnabbing\n // TODO: detect chrome extensions & packaged apps\n // a.target = '_blank'\n if (typeof blob === 'string') {\n // Support regular links\n a.href = blob;\n if (a.origin !== location.origin) {\n if (corsEnabled(a.href)) {\n download(blob, name, opts);\n }\n else {\n a.target = '_blank';\n click(a);\n }\n }\n else {\n click(a);\n }\n }\n else {\n // Support blobs\n a.href = URL.createObjectURL(blob);\n setTimeout(function () {\n URL.revokeObjectURL(a.href);\n }, 4e4); // 40s\n setTimeout(function () {\n click(a);\n }, 0);\n }\n}\nfunction msSaveAs(blob, name = 'download', opts) {\n if (typeof blob === 'string') {\n if (corsEnabled(blob)) {\n download(blob, name, opts);\n }\n else {\n const a = document.createElement('a');\n a.href = blob;\n a.target = '_blank';\n setTimeout(function () {\n click(a);\n });\n }\n }\n else {\n // @ts-ignore: works on windows\n navigator.msSaveOrOpenBlob(bom(blob, opts), name);\n }\n}\nfunction fileSaverSaveAs(blob, name, opts, popup) {\n // Open a popup immediately do go around popup blocker\n // Mostly only available on user interaction and the fileReader is async so...\n popup = popup || open('', '_blank');\n if (popup) {\n popup.document.title = popup.document.body.innerText = 'downloading...';\n }\n if (typeof blob === 'string')\n return download(blob, name, opts);\n const force = blob.type === 'application/octet-stream';\n const isSafari = /constructor/i.test(String(_global.HTMLElement)) || 'safari' in _global;\n const isChromeIOS = /CriOS\\/[\\d]+/.test(navigator.userAgent);\n if ((isChromeIOS || (force && isSafari) || isMacOSWebView) &&\n typeof FileReader !== 'undefined') {\n // Safari doesn't allow downloading of blob URLs\n const reader = new FileReader();\n reader.onloadend = function () {\n let url = reader.result;\n if (typeof url !== 'string') {\n popup = null;\n throw new Error('Wrong reader.result type');\n }\n url = isChromeIOS\n ? url\n : url.replace(/^data:[^;]*;/, 'data:attachment/file;');\n if (popup) {\n popup.location.href = url;\n }\n else {\n location.assign(url);\n }\n popup = null; // reverse-tabnabbing #460\n };\n reader.readAsDataURL(blob);\n }\n else {\n const url = URL.createObjectURL(blob);\n if (popup)\n popup.location.assign(url);\n else\n location.href = url;\n popup = null; // reverse-tabnabbing #460\n setTimeout(function () {\n URL.revokeObjectURL(url);\n }, 4e4); // 40s\n }\n}\n\n/**\n * Shows a toast or console.log\n *\n * @param message - message to log\n * @param type - different color of the tooltip\n */\nfunction toastMessage(message, type) {\n const piniaMessage = '๐Ÿ ' + message;\n if (typeof __VUE_DEVTOOLS_TOAST__ === 'function') {\n // No longer available :(\n __VUE_DEVTOOLS_TOAST__(piniaMessage, type);\n }\n else if (type === 'error') {\n console.error(piniaMessage);\n }\n else if (type === 'warn') {\n console.warn(piniaMessage);\n }\n else {\n console.log(piniaMessage);\n }\n}\nfunction isPinia(o) {\n return '_a' in o && 'install' in o;\n}\n\n/**\n * This file contain devtools actions, they are not Pinia actions.\n */\n// ---\nfunction checkClipboardAccess() {\n if (!('clipboard' in navigator)) {\n toastMessage(`Your browser doesn't support the Clipboard API`, 'error');\n return true;\n }\n}\nfunction checkNotFocusedError(error) {\n if (error instanceof Error &&\n error.message.toLowerCase().includes('document is not focused')) {\n toastMessage('You need to activate the \"Emulate a focused page\" setting in the \"Rendering\" panel of devtools.', 'warn');\n return true;\n }\n return false;\n}\nasync function actionGlobalCopyState(pinia) {\n if (checkClipboardAccess())\n return;\n try {\n await navigator.clipboard.writeText(JSON.stringify(pinia.state.value));\n toastMessage('Global state copied to clipboard.');\n }\n catch (error) {\n if (checkNotFocusedError(error))\n return;\n toastMessage(`Failed to serialize the state. Check the console for more details.`, 'error');\n console.error(error);\n }\n}\nasync function actionGlobalPasteState(pinia) {\n if (checkClipboardAccess())\n return;\n try {\n loadStoresState(pinia, JSON.parse(await navigator.clipboard.readText()));\n toastMessage('Global state pasted from clipboard.');\n }\n catch (error) {\n if (checkNotFocusedError(error))\n return;\n toastMessage(`Failed to deserialize the state from clipboard. Check the console for more details.`, 'error');\n console.error(error);\n }\n}\nasync function actionGlobalSaveState(pinia) {\n try {\n saveAs(new Blob([JSON.stringify(pinia.state.value)], {\n type: 'text/plain;charset=utf-8',\n }), 'pinia-state.json');\n }\n catch (error) {\n toastMessage(`Failed to export the state as JSON. Check the console for more details.`, 'error');\n console.error(error);\n }\n}\nlet fileInput;\nfunction getFileOpener() {\n if (!fileInput) {\n fileInput = document.createElement('input');\n fileInput.type = 'file';\n fileInput.accept = '.json';\n }\n function openFile() {\n return new Promise((resolve, reject) => {\n fileInput.onchange = async () => {\n const files = fileInput.files;\n if (!files)\n return resolve(null);\n const file = files.item(0);\n if (!file)\n return resolve(null);\n return resolve({ text: await file.text(), file });\n };\n // @ts-ignore: TODO: changed from 4.3 to 4.4\n fileInput.oncancel = () => resolve(null);\n fileInput.onerror = reject;\n fileInput.click();\n });\n }\n return openFile;\n}\nasync function actionGlobalOpenStateFile(pinia) {\n try {\n const open = getFileOpener();\n const result = await open();\n if (!result)\n return;\n const { text, file } = result;\n loadStoresState(pinia, JSON.parse(text));\n toastMessage(`Global state imported from \"${file.name}\".`);\n }\n catch (error) {\n toastMessage(`Failed to import the state from JSON. Check the console for more details.`, 'error');\n console.error(error);\n }\n}\nfunction loadStoresState(pinia, state) {\n for (const key in state) {\n const storeState = pinia.state.value[key];\n // store is already instantiated, patch it\n if (storeState) {\n Object.assign(storeState, state[key]);\n }\n else {\n // store is not instantiated, set the initial state\n pinia.state.value[key] = state[key];\n }\n }\n}\n\nfunction formatDisplay(display) {\n return {\n _custom: {\n display,\n },\n };\n}\nconst PINIA_ROOT_LABEL = '๐Ÿ Pinia (root)';\nconst PINIA_ROOT_ID = '_root';\nfunction formatStoreForInspectorTree(store) {\n return isPinia(store)\n ? {\n id: PINIA_ROOT_ID,\n label: PINIA_ROOT_LABEL,\n }\n : {\n id: store.$id,\n label: store.$id,\n };\n}\nfunction formatStoreForInspectorState(store) {\n if (isPinia(store)) {\n const storeNames = Array.from(store._s.keys());\n const storeMap = store._s;\n const state = {\n state: storeNames.map((storeId) => ({\n editable: true,\n key: storeId,\n value: store.state.value[storeId],\n })),\n getters: storeNames\n .filter((id) => storeMap.get(id)._getters)\n .map((id) => {\n const store = storeMap.get(id);\n return {\n editable: false,\n key: id,\n value: store._getters.reduce((getters, key) => {\n getters[key] = store[key];\n return getters;\n }, {}),\n };\n }),\n };\n return state;\n }\n const state = {\n state: Object.keys(store.$state).map((key) => ({\n editable: true,\n key,\n value: store.$state[key],\n })),\n };\n // avoid adding empty getters\n if (store._getters && store._getters.length) {\n state.getters = store._getters.map((getterName) => ({\n editable: false,\n key: getterName,\n value: store[getterName],\n }));\n }\n if (store._customProperties.size) {\n state.customProperties = Array.from(store._customProperties).map((key) => ({\n editable: true,\n key,\n value: store[key],\n }));\n }\n return state;\n}\nfunction formatEventData(events) {\n if (!events)\n return {};\n if (Array.isArray(events)) {\n // TODO: handle add and delete for arrays and objects\n return events.reduce((data, event) => {\n data.keys.push(event.key);\n data.operations.push(event.type);\n data.oldValue[event.key] = event.oldValue;\n data.newValue[event.key] = event.newValue;\n return data;\n }, {\n oldValue: {},\n keys: [],\n operations: [],\n newValue: {},\n });\n }\n else {\n return {\n operation: formatDisplay(events.type),\n key: formatDisplay(events.key),\n oldValue: events.oldValue,\n newValue: events.newValue,\n };\n }\n}\nfunction formatMutationType(type) {\n switch (type) {\n case MutationType.direct:\n return 'mutation';\n case MutationType.patchFunction:\n return '$patch';\n case MutationType.patchObject:\n return '$patch';\n default:\n return 'unknown';\n }\n}\n\n// timeline can be paused when directly changing the state\nlet isTimelineActive = true;\nconst componentStateTypes = [];\nconst MUTATIONS_LAYER_ID = 'pinia:mutations';\nconst INSPECTOR_ID = 'pinia';\nconst { assign: assign$1 } = Object;\n/**\n * Gets the displayed name of a store in devtools\n *\n * @param id - id of the store\n * @returns a formatted string\n */\nconst getStoreType = (id) => '๐Ÿ ' + id;\n/**\n * Add the pinia plugin without any store. Allows displaying a Pinia plugin tab\n * as soon as it is added to the application.\n *\n * @param app - Vue application\n * @param pinia - pinia instance\n */\nfunction registerPiniaDevtools(app, pinia) {\n setupDevtoolsPlugin({\n id: 'dev.esm.pinia',\n label: 'Pinia ๐Ÿ',\n logo: 'https://pinia.vuejs.org/logo.svg',\n packageName: 'pinia',\n homepage: 'https://pinia.vuejs.org',\n componentStateTypes,\n app,\n }, (api) => {\n if (typeof api.now !== 'function') {\n toastMessage('You seem to be using an outdated version of Vue Devtools. Are you still using the Beta release instead of the stable one? You can find the links at https://devtools.vuejs.org/guide/installation.html.');\n }\n api.addTimelineLayer({\n id: MUTATIONS_LAYER_ID,\n label: `Pinia ๐Ÿ`,\n color: 0xe5df88,\n });\n api.addInspector({\n id: INSPECTOR_ID,\n label: 'Pinia ๐Ÿ',\n icon: 'storage',\n treeFilterPlaceholder: 'Search stores',\n actions: [\n {\n icon: 'content_copy',\n action: () => {\n actionGlobalCopyState(pinia);\n },\n tooltip: 'Serialize and copy the state',\n },\n {\n icon: 'content_paste',\n action: async () => {\n await actionGlobalPasteState(pinia);\n api.sendInspectorTree(INSPECTOR_ID);\n api.sendInspectorState(INSPECTOR_ID);\n },\n tooltip: 'Replace the state with the content of your clipboard',\n },\n {\n icon: 'save',\n action: () => {\n actionGlobalSaveState(pinia);\n },\n tooltip: 'Save the state as a JSON file',\n },\n {\n icon: 'folder_open',\n action: async () => {\n await actionGlobalOpenStateFile(pinia);\n api.sendInspectorTree(INSPECTOR_ID);\n api.sendInspectorState(INSPECTOR_ID);\n },\n tooltip: 'Import the state from a JSON file',\n },\n ],\n nodeActions: [\n {\n icon: 'restore',\n tooltip: 'Reset the state (with \"$reset\")',\n action: (nodeId) => {\n const store = pinia._s.get(nodeId);\n if (!store) {\n toastMessage(`Cannot reset \"${nodeId}\" store because it wasn't found.`, 'warn');\n }\n else if (typeof store.$reset !== 'function') {\n toastMessage(`Cannot reset \"${nodeId}\" store because it doesn't have a \"$reset\" method implemented.`, 'warn');\n }\n else {\n store.$reset();\n toastMessage(`Store \"${nodeId}\" reset.`);\n }\n },\n },\n ],\n });\n api.on.inspectComponent((payload, ctx) => {\n const proxy = (payload.componentInstance &&\n payload.componentInstance.proxy);\n if (proxy && proxy._pStores) {\n const piniaStores = payload.componentInstance.proxy._pStores;\n Object.values(piniaStores).forEach((store) => {\n payload.instanceData.state.push({\n type: getStoreType(store.$id),\n key: 'state',\n editable: true,\n value: store._isOptionsAPI\n ? {\n _custom: {\n value: toRaw(store.$state),\n actions: [\n {\n icon: 'restore',\n tooltip: 'Reset the state of this store',\n action: () => store.$reset(),\n },\n ],\n },\n }\n : // NOTE: workaround to unwrap transferred refs\n Object.keys(store.$state).reduce((state, key) => {\n state[key] = store.$state[key];\n return state;\n }, {}),\n });\n if (store._getters && store._getters.length) {\n payload.instanceData.state.push({\n type: getStoreType(store.$id),\n key: 'getters',\n editable: false,\n value: store._getters.reduce((getters, key) => {\n try {\n getters[key] = store[key];\n }\n catch (error) {\n // @ts-expect-error: we just want to show it in devtools\n getters[key] = error;\n }\n return getters;\n }, {}),\n });\n }\n });\n }\n });\n api.on.getInspectorTree((payload) => {\n if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {\n let stores = [pinia];\n stores = stores.concat(Array.from(pinia._s.values()));\n payload.rootNodes = (payload.filter\n ? stores.filter((store) => '$id' in store\n ? store.$id\n .toLowerCase()\n .includes(payload.filter.toLowerCase())\n : PINIA_ROOT_LABEL.toLowerCase().includes(payload.filter.toLowerCase()))\n : stores).map(formatStoreForInspectorTree);\n }\n });\n // Expose pinia instance as $pinia to window\n globalThis.$pinia = pinia;\n api.on.getInspectorState((payload) => {\n if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {\n const inspectedStore = payload.nodeId === PINIA_ROOT_ID\n ? pinia\n : pinia._s.get(payload.nodeId);\n if (!inspectedStore) {\n // this could be the selected store restored for a different project\n // so it's better not to say anything here\n return;\n }\n if (inspectedStore) {\n // Expose selected store as $store to window\n if (payload.nodeId !== PINIA_ROOT_ID)\n globalThis.$store = toRaw(inspectedStore);\n payload.state = formatStoreForInspectorState(inspectedStore);\n }\n }\n });\n api.on.editInspectorState((payload, ctx) => {\n if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {\n const inspectedStore = payload.nodeId === PINIA_ROOT_ID\n ? pinia\n : pinia._s.get(payload.nodeId);\n if (!inspectedStore) {\n return toastMessage(`store \"${payload.nodeId}\" not found`, 'error');\n }\n const { path } = payload;\n if (!isPinia(inspectedStore)) {\n // access only the state\n if (path.length !== 1 ||\n !inspectedStore._customProperties.has(path[0]) ||\n path[0] in inspectedStore.$state) {\n path.unshift('$state');\n }\n }\n else {\n // Root access, we can omit the `.value` because the devtools API does it for us\n path.unshift('state');\n }\n isTimelineActive = false;\n payload.set(inspectedStore, path, payload.state.value);\n isTimelineActive = true;\n }\n });\n api.on.editComponentState((payload) => {\n if (payload.type.startsWith('๐Ÿ')) {\n const storeId = payload.type.replace(/^๐Ÿ\\s*/, '');\n const store = pinia._s.get(storeId);\n if (!store) {\n return toastMessage(`store \"${storeId}\" not found`, 'error');\n }\n const { path } = payload;\n if (path[0] !== 'state') {\n return toastMessage(`Invalid path for store \"${storeId}\":\\n${path}\\nOnly state can be modified.`);\n }\n // rewrite the first entry to be able to directly set the state as\n // well as any other path\n path[0] = '$state';\n isTimelineActive = false;\n payload.set(store, path, payload.state.value);\n isTimelineActive = true;\n }\n });\n });\n}\nfunction addStoreToDevtools(app, store) {\n if (!componentStateTypes.includes(getStoreType(store.$id))) {\n componentStateTypes.push(getStoreType(store.$id));\n }\n setupDevtoolsPlugin({\n id: 'dev.esm.pinia',\n label: 'Pinia ๐Ÿ',\n logo: 'https://pinia.vuejs.org/logo.svg',\n packageName: 'pinia',\n homepage: 'https://pinia.vuejs.org',\n componentStateTypes,\n app,\n settings: {\n logStoreChanges: {\n label: 'Notify about new/deleted stores',\n type: 'boolean',\n defaultValue: true,\n },\n // useEmojis: {\n // label: 'Use emojis in messages โšก๏ธ',\n // type: 'boolean',\n // defaultValue: true,\n // },\n },\n }, (api) => {\n // gracefully handle errors\n const now = typeof api.now === 'function' ? api.now.bind(api) : Date.now;\n store.$onAction(({ after, onError, name, args }) => {\n const groupId = runningActionId++;\n api.addTimelineEvent({\n layerId: MUTATIONS_LAYER_ID,\n event: {\n time: now(),\n title: '๐Ÿ›ซ ' + name,\n subtitle: 'start',\n data: {\n store: formatDisplay(store.$id),\n action: formatDisplay(name),\n args,\n },\n groupId,\n },\n });\n after((result) => {\n activeAction = undefined;\n api.addTimelineEvent({\n layerId: MUTATIONS_LAYER_ID,\n event: {\n time: now(),\n title: '๐Ÿ›ฌ ' + name,\n subtitle: 'end',\n data: {\n store: formatDisplay(store.$id),\n action: formatDisplay(name),\n args,\n result,\n },\n groupId,\n },\n });\n });\n onError((error) => {\n activeAction = undefined;\n api.addTimelineEvent({\n layerId: MUTATIONS_LAYER_ID,\n event: {\n time: now(),\n logType: 'error',\n title: '๐Ÿ’ฅ ' + name,\n subtitle: 'end',\n data: {\n store: formatDisplay(store.$id),\n action: formatDisplay(name),\n args,\n error,\n },\n groupId,\n },\n });\n });\n }, true);\n store._customProperties.forEach((name) => {\n watch(() => unref(store[name]), (newValue, oldValue) => {\n api.notifyComponentUpdate();\n api.sendInspectorState(INSPECTOR_ID);\n if (isTimelineActive) {\n api.addTimelineEvent({\n layerId: MUTATIONS_LAYER_ID,\n event: {\n time: now(),\n title: 'Change',\n subtitle: name,\n data: {\n newValue,\n oldValue,\n },\n groupId: activeAction,\n },\n });\n }\n }, { deep: true });\n });\n store.$subscribe(({ events, type }, state) => {\n api.notifyComponentUpdate();\n api.sendInspectorState(INSPECTOR_ID);\n if (!isTimelineActive)\n return;\n // rootStore.state[store.id] = state\n const eventData = {\n time: now(),\n title: formatMutationType(type),\n data: assign$1({ store: formatDisplay(store.$id) }, formatEventData(events)),\n groupId: activeAction,\n };\n if (type === MutationType.patchFunction) {\n eventData.subtitle = 'โคต๏ธ';\n }\n else if (type === MutationType.patchObject) {\n eventData.subtitle = '๐Ÿงฉ';\n }\n else if (events && !Array.isArray(events)) {\n eventData.subtitle = events.type;\n }\n if (events) {\n eventData.data['rawEvent(s)'] = {\n _custom: {\n display: 'DebuggerEvent',\n type: 'object',\n tooltip: 'raw DebuggerEvent[]',\n value: events,\n },\n };\n }\n api.addTimelineEvent({\n layerId: MUTATIONS_LAYER_ID,\n event: eventData,\n });\n }, { detached: true, flush: 'sync' });\n const hotUpdate = store._hotUpdate;\n store._hotUpdate = markRaw((newStore) => {\n hotUpdate(newStore);\n api.addTimelineEvent({\n layerId: MUTATIONS_LAYER_ID,\n event: {\n time: now(),\n title: '๐Ÿ”ฅ ' + store.$id,\n subtitle: 'HMR update',\n data: {\n store: formatDisplay(store.$id),\n info: formatDisplay(`HMR update`),\n },\n },\n });\n // update the devtools too\n api.notifyComponentUpdate();\n api.sendInspectorTree(INSPECTOR_ID);\n api.sendInspectorState(INSPECTOR_ID);\n });\n const { $dispose } = store;\n store.$dispose = () => {\n $dispose();\n api.notifyComponentUpdate();\n api.sendInspectorTree(INSPECTOR_ID);\n api.sendInspectorState(INSPECTOR_ID);\n api.getSettings().logStoreChanges &&\n toastMessage(`Disposed \"${store.$id}\" store ๐Ÿ—‘`);\n };\n // trigger an update so it can display new registered stores\n api.notifyComponentUpdate();\n api.sendInspectorTree(INSPECTOR_ID);\n api.sendInspectorState(INSPECTOR_ID);\n api.getSettings().logStoreChanges &&\n toastMessage(`\"${store.$id}\" store installed ๐Ÿ†•`);\n });\n}\nlet runningActionId = 0;\nlet activeAction;\n/**\n * Patches a store to enable action grouping in devtools by wrapping the store with a Proxy that is passed as the\n * context of all actions, allowing us to set `runningAction` on each access and effectively associating any state\n * mutation to the action.\n *\n * @param store - store to patch\n * @param actionNames - list of actionst to patch\n */\nfunction patchActionForGrouping(store, actionNames, wrapWithProxy) {\n // original actions of the store as they are given by pinia. We are going to override them\n const actions = actionNames.reduce((storeActions, actionName) => {\n // use toRaw to avoid tracking #541\n storeActions[actionName] = toRaw(store)[actionName];\n return storeActions;\n }, {});\n for (const actionName in actions) {\n store[actionName] = function () {\n // the running action id is incremented in a before action hook\n const _actionId = runningActionId;\n const trackedStore = wrapWithProxy\n ? new Proxy(store, {\n get(...args) {\n activeAction = _actionId;\n return Reflect.get(...args);\n },\n set(...args) {\n activeAction = _actionId;\n return Reflect.set(...args);\n },\n })\n : store;\n // For Setup Stores we need https://github.com/tc39/proposal-async-context\n activeAction = _actionId;\n const retValue = actions[actionName].apply(trackedStore, arguments);\n // this is safer as async actions in Setup Stores would associate mutations done outside of the action\n activeAction = undefined;\n return retValue;\n };\n }\n}\n/**\n * pinia.use(devtoolsPlugin)\n */\nfunction devtoolsPlugin({ app, store, options }) {\n // HMR module\n if (store.$id.startsWith('__hot:')) {\n return;\n }\n // detect option api vs setup api\n store._isOptionsAPI = !!options.state;\n // Do not overwrite actions mocked by @pinia/testing (#2298)\n if (!store._p._testing) {\n patchActionForGrouping(store, Object.keys(options.actions), store._isOptionsAPI);\n // Upgrade the HMR to also update the new actions\n const originalHotUpdate = store._hotUpdate;\n toRaw(store)._hotUpdate = function (newStore) {\n originalHotUpdate.apply(this, arguments);\n patchActionForGrouping(store, Object.keys(newStore._hmrPayload.actions), !!store._isOptionsAPI);\n };\n }\n addStoreToDevtools(app, \n // FIXME: is there a way to allow the assignment from Store to StoreGeneric?\n store);\n}\n\n/**\n * Creates a Pinia instance to be used by the application\n */\nfunction createPinia() {\n const scope = effectScope(true);\n // NOTE: here we could check the window object for a state and directly set it\n // if there is anything like it with Vue 3 SSR\n const state = scope.run(() => ref({}));\n let _p = [];\n // plugins added before calling app.use(pinia)\n let toBeInstalled = [];\n const pinia = markRaw({\n install(app) {\n // this allows calling useStore() outside of a component setup after\n // installing pinia's plugin\n setActivePinia(pinia);\n if (!isVue2) {\n pinia._a = app;\n app.provide(piniaSymbol, pinia);\n app.config.globalProperties.$pinia = pinia;\n /* istanbul ignore else */\n if ((((process.env.NODE_ENV !== 'production') || (typeof __VUE_PROD_DEVTOOLS__ !== 'undefined' && __VUE_PROD_DEVTOOLS__)) && !(process.env.NODE_ENV === 'test')) && IS_CLIENT) {\n registerPiniaDevtools(app, pinia);\n }\n toBeInstalled.forEach((plugin) => _p.push(plugin));\n toBeInstalled = [];\n }\n },\n use(plugin) {\n if (!this._a && !isVue2) {\n toBeInstalled.push(plugin);\n }\n else {\n _p.push(plugin);\n }\n return this;\n },\n _p,\n // it's actually undefined here\n // @ts-expect-error\n _a: null,\n _e: scope,\n _s: new Map(),\n state,\n });\n // pinia devtools rely on dev only features so they cannot be forced unless\n // the dev build of Vue is used. Avoid old browsers like IE11.\n if ((((process.env.NODE_ENV !== 'production') || (typeof __VUE_PROD_DEVTOOLS__ !== 'undefined' && __VUE_PROD_DEVTOOLS__)) && !(process.env.NODE_ENV === 'test')) && typeof Proxy !== 'undefined') {\n pinia.use(devtoolsPlugin);\n }\n return pinia;\n}\n/**\n * Dispose a Pinia instance by stopping its effectScope and removing the state, plugins and stores. This is mostly\n * useful in tests, with both a testing pinia or a regular pinia and in applications that use multiple pinia instances.\n * Once disposed, the pinia instance cannot be used anymore.\n *\n * @param pinia - pinia instance\n */\nfunction disposePinia(pinia) {\n pinia._e.stop();\n pinia._s.clear();\n pinia._p.splice(0);\n pinia.state.value = {};\n // @ts-expect-error: non valid\n pinia._a = null;\n}\n\n/**\n * Checks if a function is a `StoreDefinition`.\n *\n * @param fn - object to test\n * @returns true if `fn` is a StoreDefinition\n */\nconst isUseStore = (fn) => {\n return typeof fn === 'function' && typeof fn.$id === 'string';\n};\n/**\n * Mutates in place `newState` with `oldState` to _hot update_ it. It will\n * remove any key not existing in `newState` and recursively merge plain\n * objects.\n *\n * @param newState - new state object to be patched\n * @param oldState - old state that should be used to patch newState\n * @returns - newState\n */\nfunction patchObject(newState, oldState) {\n // no need to go through symbols because they cannot be serialized anyway\n for (const key in oldState) {\n const subPatch = oldState[key];\n // skip the whole sub tree\n if (!(key in newState)) {\n continue;\n }\n const targetValue = newState[key];\n if (isPlainObject(targetValue) &&\n isPlainObject(subPatch) &&\n !isRef(subPatch) &&\n !isReactive(subPatch)) {\n newState[key] = patchObject(targetValue, subPatch);\n }\n else {\n // objects are either a bit more complex (e.g. refs) or primitives, so we\n // just set the whole thing\n if (isVue2) {\n set(newState, key, subPatch);\n }\n else {\n newState[key] = subPatch;\n }\n }\n }\n return newState;\n}\n/**\n * Creates an _accept_ function to pass to `import.meta.hot` in Vite applications.\n *\n * @example\n * ```js\n * const useUser = defineStore(...)\n * if (import.meta.hot) {\n * import.meta.hot.accept(acceptHMRUpdate(useUser, import.meta.hot))\n * }\n * ```\n *\n * @param initialUseStore - return of the defineStore to hot update\n * @param hot - `import.meta.hot`\n */\nfunction acceptHMRUpdate(initialUseStore, hot) {\n // strip as much as possible from iife.prod\n if (!(process.env.NODE_ENV !== 'production')) {\n return () => { };\n }\n return (newModule) => {\n const pinia = hot.data.pinia || initialUseStore._pinia;\n if (!pinia) {\n // this store is still not used\n return;\n }\n // preserve the pinia instance across loads\n hot.data.pinia = pinia;\n // console.log('got data', newStore)\n for (const exportName in newModule) {\n const useStore = newModule[exportName];\n // console.log('checking for', exportName)\n if (isUseStore(useStore) && pinia._s.has(useStore.$id)) {\n // console.log('Accepting update for', useStore.$id)\n const id = useStore.$id;\n if (id !== initialUseStore.$id) {\n console.warn(`The id of the store changed from \"${initialUseStore.$id}\" to \"${id}\". Reloading.`);\n // return import.meta.hot.invalidate()\n return hot.invalidate();\n }\n const existingStore = pinia._s.get(id);\n if (!existingStore) {\n console.log(`[Pinia]: skipping hmr because store doesn't exist yet`);\n return;\n }\n useStore(pinia, existingStore);\n }\n }\n };\n}\n\nconst noop = () => { };\nfunction addSubscription(subscriptions, callback, detached, onCleanup = noop) {\n subscriptions.push(callback);\n const removeSubscription = () => {\n const idx = subscriptions.indexOf(callback);\n if (idx > -1) {\n subscriptions.splice(idx, 1);\n onCleanup();\n }\n };\n if (!detached && getCurrentScope()) {\n onScopeDispose(removeSubscription);\n }\n return removeSubscription;\n}\nfunction triggerSubscriptions(subscriptions, ...args) {\n subscriptions.slice().forEach((callback) => {\n callback(...args);\n });\n}\n\nconst fallbackRunWithContext = (fn) => fn();\n/**\n * Marks a function as an action for `$onAction`\n * @internal\n */\nconst ACTION_MARKER = Symbol();\n/**\n * Action name symbol. Allows to add a name to an action after defining it\n * @internal\n */\nconst ACTION_NAME = Symbol();\nfunction mergeReactiveObjects(target, patchToApply) {\n // Handle Map instances\n if (target instanceof Map && patchToApply instanceof Map) {\n patchToApply.forEach((value, key) => target.set(key, value));\n }\n else if (target instanceof Set && patchToApply instanceof Set) {\n // Handle Set instances\n patchToApply.forEach(target.add, target);\n }\n // no need to go through symbols because they cannot be serialized anyway\n for (const key in patchToApply) {\n if (!patchToApply.hasOwnProperty(key))\n continue;\n const subPatch = patchToApply[key];\n const targetValue = target[key];\n if (isPlainObject(targetValue) &&\n isPlainObject(subPatch) &&\n target.hasOwnProperty(key) &&\n !isRef(subPatch) &&\n !isReactive(subPatch)) {\n // NOTE: here I wanted to warn about inconsistent types but it's not possible because in setup stores one might\n // start the value of a property as a certain type e.g. a Map, and then for some reason, during SSR, change that\n // to `undefined`. When trying to hydrate, we want to override the Map with `undefined`.\n target[key] = mergeReactiveObjects(targetValue, subPatch);\n }\n else {\n // @ts-expect-error: subPatch is a valid value\n target[key] = subPatch;\n }\n }\n return target;\n}\nconst skipHydrateSymbol = (process.env.NODE_ENV !== 'production')\n ? Symbol('pinia:skipHydration')\n : /* istanbul ignore next */ Symbol();\nconst skipHydrateMap = /*#__PURE__*/ new WeakMap();\n/**\n * Tells Pinia to skip the hydration process of a given object. This is useful in setup stores (only) when you return a\n * stateful object in the store but it isn't really state. e.g. returning a router instance in a setup store.\n *\n * @param obj - target object\n * @returns obj\n */\nfunction skipHydrate(obj) {\n return isVue2\n ? // in @vue/composition-api, the refs are sealed so defineProperty doesn't work...\n /* istanbul ignore next */ skipHydrateMap.set(obj, 1) && obj\n : Object.defineProperty(obj, skipHydrateSymbol, {});\n}\n/**\n * Returns whether a value should be hydrated\n *\n * @param obj - target variable\n * @returns true if `obj` should be hydrated\n */\nfunction shouldHydrate(obj) {\n return isVue2\n ? /* istanbul ignore next */ !skipHydrateMap.has(obj)\n : !isPlainObject(obj) || !obj.hasOwnProperty(skipHydrateSymbol);\n}\nconst { assign } = Object;\nfunction isComputed(o) {\n return !!(isRef(o) && o.effect);\n}\nfunction createOptionsStore(id, options, pinia, hot) {\n const { state, actions, getters } = options;\n const initialState = pinia.state.value[id];\n let store;\n function setup() {\n if (!initialState && (!(process.env.NODE_ENV !== 'production') || !hot)) {\n /* istanbul ignore if */\n if (isVue2) {\n set(pinia.state.value, id, state ? state() : {});\n }\n else {\n pinia.state.value[id] = state ? state() : {};\n }\n }\n // avoid creating a state in pinia.state.value\n const localState = (process.env.NODE_ENV !== 'production') && hot\n ? // use ref() to unwrap refs inside state TODO: check if this is still necessary\n toRefs(ref(state ? state() : {}).value)\n : toRefs(pinia.state.value[id]);\n return assign(localState, actions, Object.keys(getters || {}).reduce((computedGetters, name) => {\n if ((process.env.NODE_ENV !== 'production') && name in localState) {\n console.warn(`[๐Ÿ]: A getter cannot have the same name as another state property. Rename one of them. Found with \"${name}\" in store \"${id}\".`);\n }\n computedGetters[name] = markRaw(computed(() => {\n setActivePinia(pinia);\n // it was created just before\n const store = pinia._s.get(id);\n // allow cross using stores\n /* istanbul ignore if */\n if (isVue2 && !store._r)\n return;\n // @ts-expect-error\n // return getters![name].call(context, context)\n // TODO: avoid reading the getter while assigning with a global variable\n return getters[name].call(store, store);\n }));\n return computedGetters;\n }, {}));\n }\n store = createSetupStore(id, setup, options, pinia, hot, true);\n return store;\n}\nfunction createSetupStore($id, setup, options = {}, pinia, hot, isOptionsStore) {\n let scope;\n const optionsForPlugin = assign({ actions: {} }, options);\n /* istanbul ignore if */\n if ((process.env.NODE_ENV !== 'production') && !pinia._e.active) {\n throw new Error('Pinia destroyed');\n }\n // watcher options for $subscribe\n const $subscribeOptions = { deep: true };\n /* istanbul ignore else */\n if ((process.env.NODE_ENV !== 'production') && !isVue2) {\n $subscribeOptions.onTrigger = (event) => {\n /* istanbul ignore else */\n if (isListening) {\n debuggerEvents = event;\n // avoid triggering this while the store is being built and the state is being set in pinia\n }\n else if (isListening == false && !store._hotUpdating) {\n // let patch send all the events together later\n /* istanbul ignore else */\n if (Array.isArray(debuggerEvents)) {\n debuggerEvents.push(event);\n }\n else {\n console.error('๐Ÿ debuggerEvents should be an array. This is most likely an internal Pinia bug.');\n }\n }\n };\n }\n // internal state\n let isListening; // set to true at the end\n let isSyncListening; // set to true at the end\n let subscriptions = [];\n let actionSubscriptions = [];\n let debuggerEvents;\n const initialState = pinia.state.value[$id];\n // avoid setting the state for option stores if it is set\n // by the setup\n if (!isOptionsStore && !initialState && (!(process.env.NODE_ENV !== 'production') || !hot)) {\n /* istanbul ignore if */\n if (isVue2) {\n set(pinia.state.value, $id, {});\n }\n else {\n pinia.state.value[$id] = {};\n }\n }\n const hotState = ref({});\n // avoid triggering too many listeners\n // https://github.com/vuejs/pinia/issues/1129\n let activeListener;\n function $patch(partialStateOrMutator) {\n let subscriptionMutation;\n isListening = isSyncListening = false;\n // reset the debugger events since patches are sync\n /* istanbul ignore else */\n if ((process.env.NODE_ENV !== 'production')) {\n debuggerEvents = [];\n }\n if (typeof partialStateOrMutator === 'function') {\n partialStateOrMutator(pinia.state.value[$id]);\n subscriptionMutation = {\n type: MutationType.patchFunction,\n storeId: $id,\n events: debuggerEvents,\n };\n }\n else {\n mergeReactiveObjects(pinia.state.value[$id], partialStateOrMutator);\n subscriptionMutation = {\n type: MutationType.patchObject,\n payload: partialStateOrMutator,\n storeId: $id,\n events: debuggerEvents,\n };\n }\n const myListenerId = (activeListener = Symbol());\n nextTick().then(() => {\n if (activeListener === myListenerId) {\n isListening = true;\n }\n });\n isSyncListening = true;\n // because we paused the watcher, we need to manually call the subscriptions\n triggerSubscriptions(subscriptions, subscriptionMutation, pinia.state.value[$id]);\n }\n const $reset = isOptionsStore\n ? function $reset() {\n const { state } = options;\n const newState = state ? state() : {};\n // we use a patch to group all changes into one single subscription\n this.$patch(($state) => {\n // @ts-expect-error: FIXME: shouldn't error?\n assign($state, newState);\n });\n }\n : /* istanbul ignore next */\n (process.env.NODE_ENV !== 'production')\n ? () => {\n throw new Error(`๐Ÿ: Store \"${$id}\" is built using the setup syntax and does not implement $reset().`);\n }\n : noop;\n function $dispose() {\n scope.stop();\n subscriptions = [];\n actionSubscriptions = [];\n pinia._s.delete($id);\n }\n /**\n * Helper that wraps function so it can be tracked with $onAction\n * @param fn - action to wrap\n * @param name - name of the action\n */\n const action = (fn, name = '') => {\n if (ACTION_MARKER in fn) {\n fn[ACTION_NAME] = name;\n return fn;\n }\n const wrappedAction = function () {\n setActivePinia(pinia);\n const args = Array.from(arguments);\n const afterCallbackList = [];\n const onErrorCallbackList = [];\n function after(callback) {\n afterCallbackList.push(callback);\n }\n function onError(callback) {\n onErrorCallbackList.push(callback);\n }\n // @ts-expect-error\n triggerSubscriptions(actionSubscriptions, {\n args,\n name: wrappedAction[ACTION_NAME],\n store,\n after,\n onError,\n });\n let ret;\n try {\n ret = fn.apply(this && this.$id === $id ? this : store, args);\n // handle sync errors\n }\n catch (error) {\n triggerSubscriptions(onErrorCallbackList, error);\n throw error;\n }\n if (ret instanceof Promise) {\n return ret\n .then((value) => {\n triggerSubscriptions(afterCallbackList, value);\n return value;\n })\n .catch((error) => {\n triggerSubscriptions(onErrorCallbackList, error);\n return Promise.reject(error);\n });\n }\n // trigger after callbacks\n triggerSubscriptions(afterCallbackList, ret);\n return ret;\n };\n wrappedAction[ACTION_MARKER] = true;\n wrappedAction[ACTION_NAME] = name; // will be set later\n // @ts-expect-error: we are intentionally limiting the returned type to just Fn\n // because all the added properties are internals that are exposed through `$onAction()` only\n return wrappedAction;\n };\n const _hmrPayload = /*#__PURE__*/ markRaw({\n actions: {},\n getters: {},\n state: [],\n hotState,\n });\n const partialStore = {\n _p: pinia,\n // _s: scope,\n $id,\n $onAction: addSubscription.bind(null, actionSubscriptions),\n $patch,\n $reset,\n $subscribe(callback, options = {}) {\n const removeSubscription = addSubscription(subscriptions, callback, options.detached, () => stopWatcher());\n const stopWatcher = scope.run(() => watch(() => pinia.state.value[$id], (state) => {\n if (options.flush === 'sync' ? isSyncListening : isListening) {\n callback({\n storeId: $id,\n type: MutationType.direct,\n events: debuggerEvents,\n }, state);\n }\n }, assign({}, $subscribeOptions, options)));\n return removeSubscription;\n },\n $dispose,\n };\n /* istanbul ignore if */\n if (isVue2) {\n // start as non ready\n partialStore._r = false;\n }\n const store = reactive((process.env.NODE_ENV !== 'production') || ((((process.env.NODE_ENV !== 'production') || (typeof __VUE_PROD_DEVTOOLS__ !== 'undefined' && __VUE_PROD_DEVTOOLS__)) && !(process.env.NODE_ENV === 'test')) && IS_CLIENT)\n ? assign({\n _hmrPayload,\n _customProperties: markRaw(new Set()), // devtools custom properties\n }, partialStore\n // must be added later\n // setupStore\n )\n : partialStore);\n // store the partial store now so the setup of stores can instantiate each other before they are finished without\n // creating infinite loops.\n pinia._s.set($id, store);\n const runWithContext = (pinia._a && pinia._a.runWithContext) || fallbackRunWithContext;\n // TODO: idea create skipSerialize that marks properties as non serializable and they are skipped\n const setupStore = runWithContext(() => pinia._e.run(() => (scope = effectScope()).run(() => setup({ action }))));\n // overwrite existing actions to support $onAction\n for (const key in setupStore) {\n const prop = setupStore[key];\n if ((isRef(prop) && !isComputed(prop)) || isReactive(prop)) {\n // mark it as a piece of state to be serialized\n if ((process.env.NODE_ENV !== 'production') && hot) {\n set(hotState.value, key, toRef(setupStore, key));\n // createOptionStore directly sets the state in pinia.state.value so we\n // can just skip that\n }\n else if (!isOptionsStore) {\n // in setup stores we must hydrate the state and sync pinia state tree with the refs the user just created\n if (initialState && shouldHydrate(prop)) {\n if (isRef(prop)) {\n prop.value = initialState[key];\n }\n else {\n // probably a reactive object, lets recursively assign\n // @ts-expect-error: prop is unknown\n mergeReactiveObjects(prop, initialState[key]);\n }\n }\n // transfer the ref to the pinia state to keep everything in sync\n /* istanbul ignore if */\n if (isVue2) {\n set(pinia.state.value[$id], key, prop);\n }\n else {\n pinia.state.value[$id][key] = prop;\n }\n }\n /* istanbul ignore else */\n if ((process.env.NODE_ENV !== 'production')) {\n _hmrPayload.state.push(key);\n }\n // action\n }\n else if (typeof prop === 'function') {\n const actionValue = (process.env.NODE_ENV !== 'production') && hot ? prop : action(prop, key);\n // this a hot module replacement store because the hotUpdate method needs\n // to do it with the right context\n /* istanbul ignore if */\n if (isVue2) {\n set(setupStore, key, actionValue);\n }\n else {\n // @ts-expect-error\n setupStore[key] = actionValue;\n }\n /* istanbul ignore else */\n if ((process.env.NODE_ENV !== 'production')) {\n _hmrPayload.actions[key] = prop;\n }\n // list actions so they can be used in plugins\n // @ts-expect-error\n optionsForPlugin.actions[key] = prop;\n }\n else if ((process.env.NODE_ENV !== 'production')) {\n // add getters for devtools\n if (isComputed(prop)) {\n _hmrPayload.getters[key] = isOptionsStore\n ? // @ts-expect-error\n options.getters[key]\n : prop;\n if (IS_CLIENT) {\n const getters = setupStore._getters ||\n // @ts-expect-error: same\n (setupStore._getters = markRaw([]));\n getters.push(key);\n }\n }\n }\n }\n // add the state, getters, and action properties\n /* istanbul ignore if */\n if (isVue2) {\n Object.keys(setupStore).forEach((key) => {\n set(store, key, setupStore[key]);\n });\n }\n else {\n assign(store, setupStore);\n // allows retrieving reactive objects with `storeToRefs()`. Must be called after assigning to the reactive object.\n // Make `storeToRefs()` work with `reactive()` #799\n assign(toRaw(store), setupStore);\n }\n // use this instead of a computed with setter to be able to create it anywhere\n // without linking the computed lifespan to wherever the store is first\n // created.\n Object.defineProperty(store, '$state', {\n get: () => ((process.env.NODE_ENV !== 'production') && hot ? hotState.value : pinia.state.value[$id]),\n set: (state) => {\n /* istanbul ignore if */\n if ((process.env.NODE_ENV !== 'production') && hot) {\n throw new Error('cannot set hotState');\n }\n $patch(($state) => {\n // @ts-expect-error: FIXME: shouldn't error?\n assign($state, state);\n });\n },\n });\n // add the hotUpdate before plugins to allow them to override it\n /* istanbul ignore else */\n if ((process.env.NODE_ENV !== 'production')) {\n store._hotUpdate = markRaw((newStore) => {\n store._hotUpdating = true;\n newStore._hmrPayload.state.forEach((stateKey) => {\n if (stateKey in store.$state) {\n const newStateTarget = newStore.$state[stateKey];\n const oldStateSource = store.$state[stateKey];\n if (typeof newStateTarget === 'object' &&\n isPlainObject(newStateTarget) &&\n isPlainObject(oldStateSource)) {\n patchObject(newStateTarget, oldStateSource);\n }\n else {\n // transfer the ref\n newStore.$state[stateKey] = oldStateSource;\n }\n }\n // patch direct access properties to allow store.stateProperty to work as\n // store.$state.stateProperty\n set(store, stateKey, toRef(newStore.$state, stateKey));\n });\n // remove deleted state properties\n Object.keys(store.$state).forEach((stateKey) => {\n if (!(stateKey in newStore.$state)) {\n del(store, stateKey);\n }\n });\n // avoid devtools logging this as a mutation\n isListening = false;\n isSyncListening = false;\n pinia.state.value[$id] = toRef(newStore._hmrPayload, 'hotState');\n isSyncListening = true;\n nextTick().then(() => {\n isListening = true;\n });\n for (const actionName in newStore._hmrPayload.actions) {\n const actionFn = newStore[actionName];\n set(store, actionName, action(actionFn, actionName));\n }\n // TODO: does this work in both setup and option store?\n for (const getterName in newStore._hmrPayload.getters) {\n const getter = newStore._hmrPayload.getters[getterName];\n const getterValue = isOptionsStore\n ? // special handling of options api\n computed(() => {\n setActivePinia(pinia);\n return getter.call(store, store);\n })\n : getter;\n set(store, getterName, getterValue);\n }\n // remove deleted getters\n Object.keys(store._hmrPayload.getters).forEach((key) => {\n if (!(key in newStore._hmrPayload.getters)) {\n del(store, key);\n }\n });\n // remove old actions\n Object.keys(store._hmrPayload.actions).forEach((key) => {\n if (!(key in newStore._hmrPayload.actions)) {\n del(store, key);\n }\n });\n // update the values used in devtools and to allow deleting new properties later on\n store._hmrPayload = newStore._hmrPayload;\n store._getters = newStore._getters;\n store._hotUpdating = false;\n });\n }\n if ((((process.env.NODE_ENV !== 'production') || (typeof __VUE_PROD_DEVTOOLS__ !== 'undefined' && __VUE_PROD_DEVTOOLS__)) && !(process.env.NODE_ENV === 'test')) && IS_CLIENT) {\n const nonEnumerable = {\n writable: true,\n configurable: true,\n // avoid warning on devtools trying to display this property\n enumerable: false,\n };\n ['_p', '_hmrPayload', '_getters', '_customProperties'].forEach((p) => {\n Object.defineProperty(store, p, assign({ value: store[p] }, nonEnumerable));\n });\n }\n /* istanbul ignore if */\n if (isVue2) {\n // mark the store as ready before plugins\n store._r = true;\n }\n // apply all plugins\n pinia._p.forEach((extender) => {\n /* istanbul ignore else */\n if ((((process.env.NODE_ENV !== 'production') || (typeof __VUE_PROD_DEVTOOLS__ !== 'undefined' && __VUE_PROD_DEVTOOLS__)) && !(process.env.NODE_ENV === 'test')) && IS_CLIENT) {\n const extensions = scope.run(() => extender({\n store: store,\n app: pinia._a,\n pinia,\n options: optionsForPlugin,\n }));\n Object.keys(extensions || {}).forEach((key) => store._customProperties.add(key));\n assign(store, extensions);\n }\n else {\n assign(store, scope.run(() => extender({\n store: store,\n app: pinia._a,\n pinia,\n options: optionsForPlugin,\n })));\n }\n });\n if ((process.env.NODE_ENV !== 'production') &&\n store.$state &&\n typeof store.$state === 'object' &&\n typeof store.$state.constructor === 'function' &&\n !store.$state.constructor.toString().includes('[native code]')) {\n console.warn(`[๐Ÿ]: The \"state\" must be a plain object. It cannot be\\n` +\n `\\tstate: () => new MyClass()\\n` +\n `Found in store \"${store.$id}\".`);\n }\n // only apply hydrate to option stores with an initial state in pinia\n if (initialState &&\n isOptionsStore &&\n options.hydrate) {\n options.hydrate(store.$state, initialState);\n }\n isListening = true;\n isSyncListening = true;\n return store;\n}\n// allows unused stores to be tree shaken\n/*! #__NO_SIDE_EFFECTS__ */\nfunction defineStore(\n// TODO: add proper types from above\nidOrOptions, setup, setupOptions) {\n let id;\n let options;\n const isSetupStore = typeof setup === 'function';\n if (typeof idOrOptions === 'string') {\n id = idOrOptions;\n // the option store setup will contain the actual options in this case\n options = isSetupStore ? setupOptions : setup;\n }\n else {\n options = idOrOptions;\n id = idOrOptions.id;\n if ((process.env.NODE_ENV !== 'production') && typeof id !== 'string') {\n throw new Error(`[๐Ÿ]: \"defineStore()\" must be passed a store id as its first argument.`);\n }\n }\n function useStore(pinia, hot) {\n const hasContext = hasInjectionContext();\n pinia =\n // in test mode, ignore the argument provided as we can always retrieve a\n // pinia instance with getActivePinia()\n ((process.env.NODE_ENV === 'test') && activePinia && activePinia._testing ? null : pinia) ||\n (hasContext ? inject(piniaSymbol, null) : null);\n if (pinia)\n setActivePinia(pinia);\n if ((process.env.NODE_ENV !== 'production') && !activePinia) {\n throw new Error(`[๐Ÿ]: \"getActivePinia()\" was called but there was no active Pinia. Are you trying to use a store before calling \"app.use(pinia)\"?\\n` +\n `See https://pinia.vuejs.org/core-concepts/outside-component-usage.html for help.\\n` +\n `This will fail in production.`);\n }\n pinia = activePinia;\n if (!pinia._s.has(id)) {\n // creating the store registers it in `pinia._s`\n if (isSetupStore) {\n createSetupStore(id, setup, options, pinia);\n }\n else {\n createOptionsStore(id, options, pinia);\n }\n /* istanbul ignore else */\n if ((process.env.NODE_ENV !== 'production')) {\n // @ts-expect-error: not the right inferred type\n useStore._pinia = pinia;\n }\n }\n const store = pinia._s.get(id);\n if ((process.env.NODE_ENV !== 'production') && hot) {\n const hotId = '__hot:' + id;\n const newStore = isSetupStore\n ? createSetupStore(hotId, setup, options, pinia, true)\n : createOptionsStore(hotId, assign({}, options), pinia, true);\n hot._hotUpdate(newStore);\n // cleanup the state properties and the store from the cache\n delete pinia.state.value[hotId];\n pinia._s.delete(hotId);\n }\n if ((process.env.NODE_ENV !== 'production') && IS_CLIENT) {\n const currentInstance = getCurrentInstance();\n // save stores in instances to access them devtools\n if (currentInstance &&\n currentInstance.proxy &&\n // avoid adding stores that are just built for hot module replacement\n !hot) {\n const vm = currentInstance.proxy;\n const cache = '_pStores' in vm ? vm._pStores : (vm._pStores = {});\n cache[id] = store;\n }\n }\n // StoreGeneric cannot be casted towards Store\n return store;\n }\n useStore.$id = id;\n return useStore;\n}\n\nlet mapStoreSuffix = 'Store';\n/**\n * Changes the suffix added by `mapStores()`. Can be set to an empty string.\n * Defaults to `\"Store\"`. Make sure to extend the MapStoresCustomization\n * interface if you are using TypeScript.\n *\n * @param suffix - new suffix\n */\nfunction setMapStoreSuffix(suffix // could be 'Store' but that would be annoying for JS\n) {\n mapStoreSuffix = suffix;\n}\n/**\n * Allows using stores without the composition API (`setup()`) by generating an\n * object to be spread in the `computed` field of a component. It accepts a list\n * of store definitions.\n *\n * @example\n * ```js\n * export default {\n * computed: {\n * // other computed properties\n * ...mapStores(useUserStore, useCartStore)\n * },\n *\n * created() {\n * this.userStore // store with id \"user\"\n * this.cartStore // store with id \"cart\"\n * }\n * }\n * ```\n *\n * @param stores - list of stores to map to an object\n */\nfunction mapStores(...stores) {\n if ((process.env.NODE_ENV !== 'production') && Array.isArray(stores[0])) {\n console.warn(`[๐Ÿ]: Directly pass all stores to \"mapStores()\" without putting them in an array:\\n` +\n `Replace\\n` +\n `\\tmapStores([useAuthStore, useCartStore])\\n` +\n `with\\n` +\n `\\tmapStores(useAuthStore, useCartStore)\\n` +\n `This will fail in production if not fixed.`);\n stores = stores[0];\n }\n return stores.reduce((reduced, useStore) => {\n // @ts-expect-error: $id is added by defineStore\n reduced[useStore.$id + mapStoreSuffix] = function () {\n return useStore(this.$pinia);\n };\n return reduced;\n }, {});\n}\n/**\n * Allows using state and getters from one store without using the composition\n * API (`setup()`) by generating an object to be spread in the `computed` field\n * of a component.\n *\n * @param useStore - store to map from\n * @param keysOrMapper - array or object\n */\nfunction mapState(useStore, keysOrMapper) {\n return Array.isArray(keysOrMapper)\n ? keysOrMapper.reduce((reduced, key) => {\n reduced[key] = function () {\n // @ts-expect-error: FIXME: should work?\n return useStore(this.$pinia)[key];\n };\n return reduced;\n }, {})\n : Object.keys(keysOrMapper).reduce((reduced, key) => {\n // @ts-expect-error\n reduced[key] = function () {\n const store = useStore(this.$pinia);\n const storeKey = keysOrMapper[key];\n // for some reason TS is unable to infer the type of storeKey to be a\n // function\n return typeof storeKey === 'function'\n ? storeKey.call(this, store)\n : // @ts-expect-error: FIXME: should work?\n store[storeKey];\n };\n return reduced;\n }, {});\n}\n/**\n * Alias for `mapState()`. You should use `mapState()` instead.\n * @deprecated use `mapState()` instead.\n */\nconst mapGetters = mapState;\n/**\n * Allows directly using actions from your store without using the composition\n * API (`setup()`) by generating an object to be spread in the `methods` field\n * of a component.\n *\n * @param useStore - store to map from\n * @param keysOrMapper - array or object\n */\nfunction mapActions(useStore, keysOrMapper) {\n return Array.isArray(keysOrMapper)\n ? keysOrMapper.reduce((reduced, key) => {\n // @ts-expect-error\n reduced[key] = function (...args) {\n // @ts-expect-error: FIXME: should work?\n return useStore(this.$pinia)[key](...args);\n };\n return reduced;\n }, {})\n : Object.keys(keysOrMapper).reduce((reduced, key) => {\n // @ts-expect-error\n reduced[key] = function (...args) {\n // @ts-expect-error: FIXME: should work?\n return useStore(this.$pinia)[keysOrMapper[key]](...args);\n };\n return reduced;\n }, {});\n}\n/**\n * Allows using state and getters from one store without using the composition\n * API (`setup()`) by generating an object to be spread in the `computed` field\n * of a component.\n *\n * @param useStore - store to map from\n * @param keysOrMapper - array or object\n */\nfunction mapWritableState(useStore, keysOrMapper) {\n return Array.isArray(keysOrMapper)\n ? keysOrMapper.reduce((reduced, key) => {\n // @ts-ignore\n reduced[key] = {\n get() {\n // @ts-expect-error: FIXME: should work?\n return useStore(this.$pinia)[key];\n },\n set(value) {\n // @ts-expect-error: FIXME: should work?\n return (useStore(this.$pinia)[key] = value);\n },\n };\n return reduced;\n }, {})\n : Object.keys(keysOrMapper).reduce((reduced, key) => {\n // @ts-ignore\n reduced[key] = {\n get() {\n // @ts-expect-error: FIXME: should work?\n return useStore(this.$pinia)[keysOrMapper[key]];\n },\n set(value) {\n // @ts-expect-error: FIXME: should work?\n return (useStore(this.$pinia)[keysOrMapper[key]] = value);\n },\n };\n return reduced;\n }, {});\n}\n\n/**\n * Creates an object of references with all the state, getters, and plugin-added\n * state properties of the store. Similar to `toRefs()` but specifically\n * designed for Pinia stores so methods and non reactive properties are\n * completely ignored.\n *\n * @param store - store to extract the refs from\n */\nfunction storeToRefs(store) {\n // See https://github.com/vuejs/pinia/issues/852\n // It's easier to just use toRefs() even if it includes more stuff\n if (isVue2) {\n // @ts-expect-error: toRefs include methods and others\n return toRefs(store);\n }\n else {\n const rawStore = toRaw(store);\n const refs = {};\n for (const key in rawStore) {\n const value = rawStore[key];\n if (isRef(value) || isReactive(value)) {\n // @ts-expect-error: the key is state or getter\n refs[key] =\n // ---\n toRef(store, key);\n }\n }\n return refs;\n }\n}\n\n/**\n * Vue 2 Plugin that must be installed for pinia to work. Note **you don't need\n * this plugin if you are using Nuxt.js**. Use the `buildModule` instead:\n * https://pinia.vuejs.org/ssr/nuxt.html.\n *\n * @example\n * ```js\n * import Vue from 'vue'\n * import { PiniaVuePlugin, createPinia } from 'pinia'\n *\n * Vue.use(PiniaVuePlugin)\n * const pinia = createPinia()\n *\n * new Vue({\n * el: '#app',\n * // ...\n * pinia,\n * })\n * ```\n *\n * @param _Vue - `Vue` imported from 'vue'.\n */\nconst PiniaVuePlugin = function (_Vue) {\n // Equivalent of\n // app.config.globalProperties.$pinia = pinia\n _Vue.mixin({\n beforeCreate() {\n const options = this.$options;\n if (options.pinia) {\n const pinia = options.pinia;\n // HACK: taken from provide(): https://github.com/vuejs/composition-api/blob/main/src/apis/inject.ts#L31\n /* istanbul ignore else */\n if (!this._provided) {\n const provideCache = {};\n Object.defineProperty(this, '_provided', {\n get: () => provideCache,\n set: (v) => Object.assign(provideCache, v),\n });\n }\n this._provided[piniaSymbol] = pinia;\n // propagate the pinia instance in an SSR friendly way\n // avoid adding it to nuxt twice\n /* istanbul ignore else */\n if (!this.$pinia) {\n this.$pinia = pinia;\n }\n pinia._a = this;\n if (IS_CLIENT) {\n // this allows calling useStore() outside of a component setup after\n // installing pinia's plugin\n setActivePinia(pinia);\n }\n if ((((process.env.NODE_ENV !== 'production') || (typeof __VUE_PROD_DEVTOOLS__ !== 'undefined' && __VUE_PROD_DEVTOOLS__)) && !(process.env.NODE_ENV === 'test')) && IS_CLIENT) {\n registerPiniaDevtools(pinia._a, pinia);\n }\n }\n else if (!this.$pinia && options.parent && options.parent.$pinia) {\n this.$pinia = options.parent.$pinia;\n }\n },\n destroyed() {\n delete this._pStores;\n },\n });\n};\n\nexport { MutationType, PiniaVuePlugin, acceptHMRUpdate, createPinia, defineStore, disposePinia, getActivePinia, mapActions, mapGetters, mapState, mapStores, mapWritableState, setActivePinia, setMapStoreSuffix, shouldHydrate, skipHydrate, storeToRefs };\n","//! moment.js\n//! version : 2.30.1\n//! authors : Tim Wood, Iskren Chernev, Moment.js contributors\n//! license : MIT\n//! momentjs.com\n\n;(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n typeof define === 'function' && define.amd ? define(factory) :\n global.moment = factory()\n}(this, (function () { 'use strict';\n\n var hookCallback;\n\n function hooks() {\n return hookCallback.apply(null, arguments);\n }\n\n // This is done to register the method called with moment()\n // without creating circular dependencies.\n function setHookCallback(callback) {\n hookCallback = callback;\n }\n\n function isArray(input) {\n return (\n input instanceof Array ||\n Object.prototype.toString.call(input) === '[object Array]'\n );\n }\n\n function isObject(input) {\n // IE8 will treat undefined and null as object if it wasn't for\n // input != null\n return (\n input != null &&\n Object.prototype.toString.call(input) === '[object Object]'\n );\n }\n\n function hasOwnProp(a, b) {\n return Object.prototype.hasOwnProperty.call(a, b);\n }\n\n function isObjectEmpty(obj) {\n if (Object.getOwnPropertyNames) {\n return Object.getOwnPropertyNames(obj).length === 0;\n } else {\n var k;\n for (k in obj) {\n if (hasOwnProp(obj, k)) {\n return false;\n }\n }\n return true;\n }\n }\n\n function isUndefined(input) {\n return input === void 0;\n }\n\n function isNumber(input) {\n return (\n typeof input === 'number' ||\n Object.prototype.toString.call(input) === '[object Number]'\n );\n }\n\n function isDate(input) {\n return (\n input instanceof Date ||\n Object.prototype.toString.call(input) === '[object Date]'\n );\n }\n\n function map(arr, fn) {\n var res = [],\n i,\n arrLen = arr.length;\n for (i = 0; i < arrLen; ++i) {\n res.push(fn(arr[i], i));\n }\n return res;\n }\n\n function extend(a, b) {\n for (var i in b) {\n if (hasOwnProp(b, i)) {\n a[i] = b[i];\n }\n }\n\n if (hasOwnProp(b, 'toString')) {\n a.toString = b.toString;\n }\n\n if (hasOwnProp(b, 'valueOf')) {\n a.valueOf = b.valueOf;\n }\n\n return a;\n }\n\n function createUTC(input, format, locale, strict) {\n return createLocalOrUTC(input, format, locale, strict, true).utc();\n }\n\n function defaultParsingFlags() {\n // We need to deep clone this object.\n return {\n empty: false,\n unusedTokens: [],\n unusedInput: [],\n overflow: -2,\n charsLeftOver: 0,\n nullInput: false,\n invalidEra: null,\n invalidMonth: null,\n invalidFormat: false,\n userInvalidated: false,\n iso: false,\n parsedDateParts: [],\n era: null,\n meridiem: null,\n rfc2822: false,\n weekdayMismatch: false,\n };\n }\n\n function getParsingFlags(m) {\n if (m._pf == null) {\n m._pf = defaultParsingFlags();\n }\n return m._pf;\n }\n\n var some;\n if (Array.prototype.some) {\n some = Array.prototype.some;\n } else {\n some = function (fun) {\n var t = Object(this),\n len = t.length >>> 0,\n i;\n\n for (i = 0; i < len; i++) {\n if (i in t && fun.call(this, t[i], i, t)) {\n return true;\n }\n }\n\n return false;\n };\n }\n\n function isValid(m) {\n var flags = null,\n parsedParts = false,\n isNowValid = m._d && !isNaN(m._d.getTime());\n if (isNowValid) {\n flags = getParsingFlags(m);\n parsedParts = some.call(flags.parsedDateParts, function (i) {\n return i != null;\n });\n isNowValid =\n flags.overflow < 0 &&\n !flags.empty &&\n !flags.invalidEra &&\n !flags.invalidMonth &&\n !flags.invalidWeekday &&\n !flags.weekdayMismatch &&\n !flags.nullInput &&\n !flags.invalidFormat &&\n !flags.userInvalidated &&\n (!flags.meridiem || (flags.meridiem && parsedParts));\n if (m._strict) {\n isNowValid =\n isNowValid &&\n flags.charsLeftOver === 0 &&\n flags.unusedTokens.length === 0 &&\n flags.bigHour === undefined;\n }\n }\n if (Object.isFrozen == null || !Object.isFrozen(m)) {\n m._isValid = isNowValid;\n } else {\n return isNowValid;\n }\n return m._isValid;\n }\n\n function createInvalid(flags) {\n var m = createUTC(NaN);\n if (flags != null) {\n extend(getParsingFlags(m), flags);\n } else {\n getParsingFlags(m).userInvalidated = true;\n }\n\n return m;\n }\n\n // Plugins that add properties should also add the key here (null value),\n // so we can properly clone ourselves.\n var momentProperties = (hooks.momentProperties = []),\n updateInProgress = false;\n\n function copyConfig(to, from) {\n var i,\n prop,\n val,\n momentPropertiesLen = momentProperties.length;\n\n if (!isUndefined(from._isAMomentObject)) {\n to._isAMomentObject = from._isAMomentObject;\n }\n if (!isUndefined(from._i)) {\n to._i = from._i;\n }\n if (!isUndefined(from._f)) {\n to._f = from._f;\n }\n if (!isUndefined(from._l)) {\n to._l = from._l;\n }\n if (!isUndefined(from._strict)) {\n to._strict = from._strict;\n }\n if (!isUndefined(from._tzm)) {\n to._tzm = from._tzm;\n }\n if (!isUndefined(from._isUTC)) {\n to._isUTC = from._isUTC;\n }\n if (!isUndefined(from._offset)) {\n to._offset = from._offset;\n }\n if (!isUndefined(from._pf)) {\n to._pf = getParsingFlags(from);\n }\n if (!isUndefined(from._locale)) {\n to._locale = from._locale;\n }\n\n if (momentPropertiesLen > 0) {\n for (i = 0; i < momentPropertiesLen; i++) {\n prop = momentProperties[i];\n val = from[prop];\n if (!isUndefined(val)) {\n to[prop] = val;\n }\n }\n }\n\n return to;\n }\n\n // Moment prototype object\n function Moment(config) {\n copyConfig(this, config);\n this._d = new Date(config._d != null ? config._d.getTime() : NaN);\n if (!this.isValid()) {\n this._d = new Date(NaN);\n }\n // Prevent infinite loop in case updateOffset creates new moment\n // objects.\n if (updateInProgress === false) {\n updateInProgress = true;\n hooks.updateOffset(this);\n updateInProgress = false;\n }\n }\n\n function isMoment(obj) {\n return (\n obj instanceof Moment || (obj != null && obj._isAMomentObject != null)\n );\n }\n\n function warn(msg) {\n if (\n hooks.suppressDeprecationWarnings === false &&\n typeof console !== 'undefined' &&\n console.warn\n ) {\n console.warn('Deprecation warning: ' + msg);\n }\n }\n\n function deprecate(msg, fn) {\n var firstTime = true;\n\n return extend(function () {\n if (hooks.deprecationHandler != null) {\n hooks.deprecationHandler(null, msg);\n }\n if (firstTime) {\n var args = [],\n arg,\n i,\n key,\n argLen = arguments.length;\n for (i = 0; i < argLen; i++) {\n arg = '';\n if (typeof arguments[i] === 'object') {\n arg += '\\n[' + i + '] ';\n for (key in arguments[0]) {\n if (hasOwnProp(arguments[0], key)) {\n arg += key + ': ' + arguments[0][key] + ', ';\n }\n }\n arg = arg.slice(0, -2); // Remove trailing comma and space\n } else {\n arg = arguments[i];\n }\n args.push(arg);\n }\n warn(\n msg +\n '\\nArguments: ' +\n Array.prototype.slice.call(args).join('') +\n '\\n' +\n new Error().stack\n );\n firstTime = false;\n }\n return fn.apply(this, arguments);\n }, fn);\n }\n\n var deprecations = {};\n\n function deprecateSimple(name, msg) {\n if (hooks.deprecationHandler != null) {\n hooks.deprecationHandler(name, msg);\n }\n if (!deprecations[name]) {\n warn(msg);\n deprecations[name] = true;\n }\n }\n\n hooks.suppressDeprecationWarnings = false;\n hooks.deprecationHandler = null;\n\n function isFunction(input) {\n return (\n (typeof Function !== 'undefined' && input instanceof Function) ||\n Object.prototype.toString.call(input) === '[object Function]'\n );\n }\n\n function set(config) {\n var prop, i;\n for (i in config) {\n if (hasOwnProp(config, i)) {\n prop = config[i];\n if (isFunction(prop)) {\n this[i] = prop;\n } else {\n this['_' + i] = prop;\n }\n }\n }\n this._config = config;\n // Lenient ordinal parsing accepts just a number in addition to\n // number + (possibly) stuff coming from _dayOfMonthOrdinalParse.\n // TODO: Remove \"ordinalParse\" fallback in next major release.\n this._dayOfMonthOrdinalParseLenient = new RegExp(\n (this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) +\n '|' +\n /\\d{1,2}/.source\n );\n }\n\n function mergeConfigs(parentConfig, childConfig) {\n var res = extend({}, parentConfig),\n prop;\n for (prop in childConfig) {\n if (hasOwnProp(childConfig, prop)) {\n if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) {\n res[prop] = {};\n extend(res[prop], parentConfig[prop]);\n extend(res[prop], childConfig[prop]);\n } else if (childConfig[prop] != null) {\n res[prop] = childConfig[prop];\n } else {\n delete res[prop];\n }\n }\n }\n for (prop in parentConfig) {\n if (\n hasOwnProp(parentConfig, prop) &&\n !hasOwnProp(childConfig, prop) &&\n isObject(parentConfig[prop])\n ) {\n // make sure changes to properties don't modify parent config\n res[prop] = extend({}, res[prop]);\n }\n }\n return res;\n }\n\n function Locale(config) {\n if (config != null) {\n this.set(config);\n }\n }\n\n var keys;\n\n if (Object.keys) {\n keys = Object.keys;\n } else {\n keys = function (obj) {\n var i,\n res = [];\n for (i in obj) {\n if (hasOwnProp(obj, i)) {\n res.push(i);\n }\n }\n return res;\n };\n }\n\n var defaultCalendar = {\n sameDay: '[Today at] LT',\n nextDay: '[Tomorrow at] LT',\n nextWeek: 'dddd [at] LT',\n lastDay: '[Yesterday at] LT',\n lastWeek: '[Last] dddd [at] LT',\n sameElse: 'L',\n };\n\n function calendar(key, mom, now) {\n var output = this._calendar[key] || this._calendar['sameElse'];\n return isFunction(output) ? output.call(mom, now) : output;\n }\n\n function zeroFill(number, targetLength, forceSign) {\n var absNumber = '' + Math.abs(number),\n zerosToFill = targetLength - absNumber.length,\n sign = number >= 0;\n return (\n (sign ? (forceSign ? '+' : '') : '-') +\n Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) +\n absNumber\n );\n }\n\n var formattingTokens =\n /(\\[[^\\[]*\\])|(\\\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,\n localFormattingTokens = /(\\[[^\\[]*\\])|(\\\\)?(LTS|LT|LL?L?L?|l{1,4})/g,\n formatFunctions = {},\n formatTokenFunctions = {};\n\n // token: 'M'\n // padded: ['MM', 2]\n // ordinal: 'Mo'\n // callback: function () { this.month() + 1 }\n function addFormatToken(token, padded, ordinal, callback) {\n var func = callback;\n if (typeof callback === 'string') {\n func = function () {\n return this[callback]();\n };\n }\n if (token) {\n formatTokenFunctions[token] = func;\n }\n if (padded) {\n formatTokenFunctions[padded[0]] = function () {\n return zeroFill(func.apply(this, arguments), padded[1], padded[2]);\n };\n }\n if (ordinal) {\n formatTokenFunctions[ordinal] = function () {\n return this.localeData().ordinal(\n func.apply(this, arguments),\n token\n );\n };\n }\n }\n\n function removeFormattingTokens(input) {\n if (input.match(/\\[[\\s\\S]/)) {\n return input.replace(/^\\[|\\]$/g, '');\n }\n return input.replace(/\\\\/g, '');\n }\n\n function makeFormatFunction(format) {\n var array = format.match(formattingTokens),\n i,\n length;\n\n for (i = 0, length = array.length; i < length; i++) {\n if (formatTokenFunctions[array[i]]) {\n array[i] = formatTokenFunctions[array[i]];\n } else {\n array[i] = removeFormattingTokens(array[i]);\n }\n }\n\n return function (mom) {\n var output = '',\n i;\n for (i = 0; i < length; i++) {\n output += isFunction(array[i])\n ? array[i].call(mom, format)\n : array[i];\n }\n return output;\n };\n }\n\n // format date using native date object\n function formatMoment(m, format) {\n if (!m.isValid()) {\n return m.localeData().invalidDate();\n }\n\n format = expandFormat(format, m.localeData());\n formatFunctions[format] =\n formatFunctions[format] || makeFormatFunction(format);\n\n return formatFunctions[format](m);\n }\n\n function expandFormat(format, locale) {\n var i = 5;\n\n function replaceLongDateFormatTokens(input) {\n return locale.longDateFormat(input) || input;\n }\n\n localFormattingTokens.lastIndex = 0;\n while (i >= 0 && localFormattingTokens.test(format)) {\n format = format.replace(\n localFormattingTokens,\n replaceLongDateFormatTokens\n );\n localFormattingTokens.lastIndex = 0;\n i -= 1;\n }\n\n return format;\n }\n\n var defaultLongDateFormat = {\n LTS: 'h:mm:ss A',\n LT: 'h:mm A',\n L: 'MM/DD/YYYY',\n LL: 'MMMM D, YYYY',\n LLL: 'MMMM D, YYYY h:mm A',\n LLLL: 'dddd, MMMM D, YYYY h:mm A',\n };\n\n function longDateFormat(key) {\n var format = this._longDateFormat[key],\n formatUpper = this._longDateFormat[key.toUpperCase()];\n\n if (format || !formatUpper) {\n return format;\n }\n\n this._longDateFormat[key] = formatUpper\n .match(formattingTokens)\n .map(function (tok) {\n if (\n tok === 'MMMM' ||\n tok === 'MM' ||\n tok === 'DD' ||\n tok === 'dddd'\n ) {\n return tok.slice(1);\n }\n return tok;\n })\n .join('');\n\n return this._longDateFormat[key];\n }\n\n var defaultInvalidDate = 'Invalid date';\n\n function invalidDate() {\n return this._invalidDate;\n }\n\n var defaultOrdinal = '%d',\n defaultDayOfMonthOrdinalParse = /\\d{1,2}/;\n\n function ordinal(number) {\n return this._ordinal.replace('%d', number);\n }\n\n var defaultRelativeTime = {\n future: 'in %s',\n past: '%s ago',\n s: 'a few seconds',\n ss: '%d seconds',\n m: 'a minute',\n mm: '%d minutes',\n h: 'an hour',\n hh: '%d hours',\n d: 'a day',\n dd: '%d days',\n w: 'a week',\n ww: '%d weeks',\n M: 'a month',\n MM: '%d months',\n y: 'a year',\n yy: '%d years',\n };\n\n function relativeTime(number, withoutSuffix, string, isFuture) {\n var output = this._relativeTime[string];\n return isFunction(output)\n ? output(number, withoutSuffix, string, isFuture)\n : output.replace(/%d/i, number);\n }\n\n function pastFuture(diff, output) {\n var format = this._relativeTime[diff > 0 ? 'future' : 'past'];\n return isFunction(format) ? format(output) : format.replace(/%s/i, output);\n }\n\n var aliases = {\n D: 'date',\n dates: 'date',\n date: 'date',\n d: 'day',\n days: 'day',\n day: 'day',\n e: 'weekday',\n weekdays: 'weekday',\n weekday: 'weekday',\n E: 'isoWeekday',\n isoweekdays: 'isoWeekday',\n isoweekday: 'isoWeekday',\n DDD: 'dayOfYear',\n dayofyears: 'dayOfYear',\n dayofyear: 'dayOfYear',\n h: 'hour',\n hours: 'hour',\n hour: 'hour',\n ms: 'millisecond',\n milliseconds: 'millisecond',\n millisecond: 'millisecond',\n m: 'minute',\n minutes: 'minute',\n minute: 'minute',\n M: 'month',\n months: 'month',\n month: 'month',\n Q: 'quarter',\n quarters: 'quarter',\n quarter: 'quarter',\n s: 'second',\n seconds: 'second',\n second: 'second',\n gg: 'weekYear',\n weekyears: 'weekYear',\n weekyear: 'weekYear',\n GG: 'isoWeekYear',\n isoweekyears: 'isoWeekYear',\n isoweekyear: 'isoWeekYear',\n w: 'week',\n weeks: 'week',\n week: 'week',\n W: 'isoWeek',\n isoweeks: 'isoWeek',\n isoweek: 'isoWeek',\n y: 'year',\n years: 'year',\n year: 'year',\n };\n\n function normalizeUnits(units) {\n return typeof units === 'string'\n ? aliases[units] || aliases[units.toLowerCase()]\n : undefined;\n }\n\n function normalizeObjectUnits(inputObject) {\n var normalizedInput = {},\n normalizedProp,\n prop;\n\n for (prop in inputObject) {\n if (hasOwnProp(inputObject, prop)) {\n normalizedProp = normalizeUnits(prop);\n if (normalizedProp) {\n normalizedInput[normalizedProp] = inputObject[prop];\n }\n }\n }\n\n return normalizedInput;\n }\n\n var priorities = {\n date: 9,\n day: 11,\n weekday: 11,\n isoWeekday: 11,\n dayOfYear: 4,\n hour: 13,\n millisecond: 16,\n minute: 14,\n month: 8,\n quarter: 7,\n second: 15,\n weekYear: 1,\n isoWeekYear: 1,\n week: 5,\n isoWeek: 5,\n year: 1,\n };\n\n function getPrioritizedUnits(unitsObj) {\n var units = [],\n u;\n for (u in unitsObj) {\n if (hasOwnProp(unitsObj, u)) {\n units.push({ unit: u, priority: priorities[u] });\n }\n }\n units.sort(function (a, b) {\n return a.priority - b.priority;\n });\n return units;\n }\n\n var match1 = /\\d/, // 0 - 9\n match2 = /\\d\\d/, // 00 - 99\n match3 = /\\d{3}/, // 000 - 999\n match4 = /\\d{4}/, // 0000 - 9999\n match6 = /[+-]?\\d{6}/, // -999999 - 999999\n match1to2 = /\\d\\d?/, // 0 - 99\n match3to4 = /\\d\\d\\d\\d?/, // 999 - 9999\n match5to6 = /\\d\\d\\d\\d\\d\\d?/, // 99999 - 999999\n match1to3 = /\\d{1,3}/, // 0 - 999\n match1to4 = /\\d{1,4}/, // 0 - 9999\n match1to6 = /[+-]?\\d{1,6}/, // -999999 - 999999\n matchUnsigned = /\\d+/, // 0 - inf\n matchSigned = /[+-]?\\d+/, // -inf - inf\n matchOffset = /Z|[+-]\\d\\d:?\\d\\d/gi, // +00:00 -00:00 +0000 -0000 or Z\n matchShortOffset = /Z|[+-]\\d\\d(?::?\\d\\d)?/gi, // +00 -00 +00:00 -00:00 +0000 -0000 or Z\n matchTimestamp = /[+-]?\\d+(\\.\\d{1,3})?/, // 123456789 123456789.123\n // any word (or two) characters or numbers including two/three word month in arabic.\n // includes scottish gaelic two word and hyphenated months\n matchWord =\n /[0-9]{0,256}['a-z\\u00A0-\\u05FF\\u0700-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFF07\\uFF10-\\uFFEF]{1,256}|[\\u0600-\\u06FF\\/]{1,256}(\\s*?[\\u0600-\\u06FF]{1,256}){1,2}/i,\n match1to2NoLeadingZero = /^[1-9]\\d?/, // 1-99\n match1to2HasZero = /^([1-9]\\d|\\d)/, // 0-99\n regexes;\n\n regexes = {};\n\n function addRegexToken(token, regex, strictRegex) {\n regexes[token] = isFunction(regex)\n ? regex\n : function (isStrict, localeData) {\n return isStrict && strictRegex ? strictRegex : regex;\n };\n }\n\n function getParseRegexForToken(token, config) {\n if (!hasOwnProp(regexes, token)) {\n return new RegExp(unescapeFormat(token));\n }\n\n return regexes[token](config._strict, config._locale);\n }\n\n // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript\n function unescapeFormat(s) {\n return regexEscape(\n s\n .replace('\\\\', '')\n .replace(\n /\\\\(\\[)|\\\\(\\])|\\[([^\\]\\[]*)\\]|\\\\(.)/g,\n function (matched, p1, p2, p3, p4) {\n return p1 || p2 || p3 || p4;\n }\n )\n );\n }\n\n function regexEscape(s) {\n return s.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&');\n }\n\n function absFloor(number) {\n if (number < 0) {\n // -0 -> 0\n return Math.ceil(number) || 0;\n } else {\n return Math.floor(number);\n }\n }\n\n function toInt(argumentForCoercion) {\n var coercedNumber = +argumentForCoercion,\n value = 0;\n\n if (coercedNumber !== 0 && isFinite(coercedNumber)) {\n value = absFloor(coercedNumber);\n }\n\n return value;\n }\n\n var tokens = {};\n\n function addParseToken(token, callback) {\n var i,\n func = callback,\n tokenLen;\n if (typeof token === 'string') {\n token = [token];\n }\n if (isNumber(callback)) {\n func = function (input, array) {\n array[callback] = toInt(input);\n };\n }\n tokenLen = token.length;\n for (i = 0; i < tokenLen; i++) {\n tokens[token[i]] = func;\n }\n }\n\n function addWeekParseToken(token, callback) {\n addParseToken(token, function (input, array, config, token) {\n config._w = config._w || {};\n callback(input, config._w, config, token);\n });\n }\n\n function addTimeToArrayFromToken(token, input, config) {\n if (input != null && hasOwnProp(tokens, token)) {\n tokens[token](input, config._a, config, token);\n }\n }\n\n function isLeapYear(year) {\n return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;\n }\n\n var YEAR = 0,\n MONTH = 1,\n DATE = 2,\n HOUR = 3,\n MINUTE = 4,\n SECOND = 5,\n MILLISECOND = 6,\n WEEK = 7,\n WEEKDAY = 8;\n\n // FORMATTING\n\n addFormatToken('Y', 0, 0, function () {\n var y = this.year();\n return y <= 9999 ? zeroFill(y, 4) : '+' + y;\n });\n\n addFormatToken(0, ['YY', 2], 0, function () {\n return this.year() % 100;\n });\n\n addFormatToken(0, ['YYYY', 4], 0, 'year');\n addFormatToken(0, ['YYYYY', 5], 0, 'year');\n addFormatToken(0, ['YYYYYY', 6, true], 0, 'year');\n\n // PARSING\n\n addRegexToken('Y', matchSigned);\n addRegexToken('YY', match1to2, match2);\n addRegexToken('YYYY', match1to4, match4);\n addRegexToken('YYYYY', match1to6, match6);\n addRegexToken('YYYYYY', match1to6, match6);\n\n addParseToken(['YYYYY', 'YYYYYY'], YEAR);\n addParseToken('YYYY', function (input, array) {\n array[YEAR] =\n input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input);\n });\n addParseToken('YY', function (input, array) {\n array[YEAR] = hooks.parseTwoDigitYear(input);\n });\n addParseToken('Y', function (input, array) {\n array[YEAR] = parseInt(input, 10);\n });\n\n // HELPERS\n\n function daysInYear(year) {\n return isLeapYear(year) ? 366 : 365;\n }\n\n // HOOKS\n\n hooks.parseTwoDigitYear = function (input) {\n return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);\n };\n\n // MOMENTS\n\n var getSetYear = makeGetSet('FullYear', true);\n\n function getIsLeapYear() {\n return isLeapYear(this.year());\n }\n\n function makeGetSet(unit, keepTime) {\n return function (value) {\n if (value != null) {\n set$1(this, unit, value);\n hooks.updateOffset(this, keepTime);\n return this;\n } else {\n return get(this, unit);\n }\n };\n }\n\n function get(mom, unit) {\n if (!mom.isValid()) {\n return NaN;\n }\n\n var d = mom._d,\n isUTC = mom._isUTC;\n\n switch (unit) {\n case 'Milliseconds':\n return isUTC ? d.getUTCMilliseconds() : d.getMilliseconds();\n case 'Seconds':\n return isUTC ? d.getUTCSeconds() : d.getSeconds();\n case 'Minutes':\n return isUTC ? d.getUTCMinutes() : d.getMinutes();\n case 'Hours':\n return isUTC ? d.getUTCHours() : d.getHours();\n case 'Date':\n return isUTC ? d.getUTCDate() : d.getDate();\n case 'Day':\n return isUTC ? d.getUTCDay() : d.getDay();\n case 'Month':\n return isUTC ? d.getUTCMonth() : d.getMonth();\n case 'FullYear':\n return isUTC ? d.getUTCFullYear() : d.getFullYear();\n default:\n return NaN; // Just in case\n }\n }\n\n function set$1(mom, unit, value) {\n var d, isUTC, year, month, date;\n\n if (!mom.isValid() || isNaN(value)) {\n return;\n }\n\n d = mom._d;\n isUTC = mom._isUTC;\n\n switch (unit) {\n case 'Milliseconds':\n return void (isUTC\n ? d.setUTCMilliseconds(value)\n : d.setMilliseconds(value));\n case 'Seconds':\n return void (isUTC ? d.setUTCSeconds(value) : d.setSeconds(value));\n case 'Minutes':\n return void (isUTC ? d.setUTCMinutes(value) : d.setMinutes(value));\n case 'Hours':\n return void (isUTC ? d.setUTCHours(value) : d.setHours(value));\n case 'Date':\n return void (isUTC ? d.setUTCDate(value) : d.setDate(value));\n // case 'Day': // Not real\n // return void (isUTC ? d.setUTCDay(value) : d.setDay(value));\n // case 'Month': // Not used because we need to pass two variables\n // return void (isUTC ? d.setUTCMonth(value) : d.setMonth(value));\n case 'FullYear':\n break; // See below ...\n default:\n return; // Just in case\n }\n\n year = value;\n month = mom.month();\n date = mom.date();\n date = date === 29 && month === 1 && !isLeapYear(year) ? 28 : date;\n void (isUTC\n ? d.setUTCFullYear(year, month, date)\n : d.setFullYear(year, month, date));\n }\n\n // MOMENTS\n\n function stringGet(units) {\n units = normalizeUnits(units);\n if (isFunction(this[units])) {\n return this[units]();\n }\n return this;\n }\n\n function stringSet(units, value) {\n if (typeof units === 'object') {\n units = normalizeObjectUnits(units);\n var prioritized = getPrioritizedUnits(units),\n i,\n prioritizedLen = prioritized.length;\n for (i = 0; i < prioritizedLen; i++) {\n this[prioritized[i].unit](units[prioritized[i].unit]);\n }\n } else {\n units = normalizeUnits(units);\n if (isFunction(this[units])) {\n return this[units](value);\n }\n }\n return this;\n }\n\n function mod(n, x) {\n return ((n % x) + x) % x;\n }\n\n var indexOf;\n\n if (Array.prototype.indexOf) {\n indexOf = Array.prototype.indexOf;\n } else {\n indexOf = function (o) {\n // I know\n var i;\n for (i = 0; i < this.length; ++i) {\n if (this[i] === o) {\n return i;\n }\n }\n return -1;\n };\n }\n\n function daysInMonth(year, month) {\n if (isNaN(year) || isNaN(month)) {\n return NaN;\n }\n var modMonth = mod(month, 12);\n year += (month - modMonth) / 12;\n return modMonth === 1\n ? isLeapYear(year)\n ? 29\n : 28\n : 31 - ((modMonth % 7) % 2);\n }\n\n // FORMATTING\n\n addFormatToken('M', ['MM', 2], 'Mo', function () {\n return this.month() + 1;\n });\n\n addFormatToken('MMM', 0, 0, function (format) {\n return this.localeData().monthsShort(this, format);\n });\n\n addFormatToken('MMMM', 0, 0, function (format) {\n return this.localeData().months(this, format);\n });\n\n // PARSING\n\n addRegexToken('M', match1to2, match1to2NoLeadingZero);\n addRegexToken('MM', match1to2, match2);\n addRegexToken('MMM', function (isStrict, locale) {\n return locale.monthsShortRegex(isStrict);\n });\n addRegexToken('MMMM', function (isStrict, locale) {\n return locale.monthsRegex(isStrict);\n });\n\n addParseToken(['M', 'MM'], function (input, array) {\n array[MONTH] = toInt(input) - 1;\n });\n\n addParseToken(['MMM', 'MMMM'], function (input, array, config, token) {\n var month = config._locale.monthsParse(input, token, config._strict);\n // if we didn't find a month name, mark the date as invalid.\n if (month != null) {\n array[MONTH] = month;\n } else {\n getParsingFlags(config).invalidMonth = input;\n }\n });\n\n // LOCALES\n\n var defaultLocaleMonths =\n 'January_February_March_April_May_June_July_August_September_October_November_December'.split(\n '_'\n ),\n defaultLocaleMonthsShort =\n 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'),\n MONTHS_IN_FORMAT = /D[oD]?(\\[[^\\[\\]]*\\]|\\s)+MMMM?/,\n defaultMonthsShortRegex = matchWord,\n defaultMonthsRegex = matchWord;\n\n function localeMonths(m, format) {\n if (!m) {\n return isArray(this._months)\n ? this._months\n : this._months['standalone'];\n }\n return isArray(this._months)\n ? this._months[m.month()]\n : this._months[\n (this._months.isFormat || MONTHS_IN_FORMAT).test(format)\n ? 'format'\n : 'standalone'\n ][m.month()];\n }\n\n function localeMonthsShort(m, format) {\n if (!m) {\n return isArray(this._monthsShort)\n ? this._monthsShort\n : this._monthsShort['standalone'];\n }\n return isArray(this._monthsShort)\n ? this._monthsShort[m.month()]\n : this._monthsShort[\n MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'\n ][m.month()];\n }\n\n function handleStrictParse(monthName, format, strict) {\n var i,\n ii,\n mom,\n llc = monthName.toLocaleLowerCase();\n if (!this._monthsParse) {\n // this is not used\n this._monthsParse = [];\n this._longMonthsParse = [];\n this._shortMonthsParse = [];\n for (i = 0; i < 12; ++i) {\n mom = createUTC([2000, i]);\n this._shortMonthsParse[i] = this.monthsShort(\n mom,\n ''\n ).toLocaleLowerCase();\n this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase();\n }\n }\n\n if (strict) {\n if (format === 'MMM') {\n ii = indexOf.call(this._shortMonthsParse, llc);\n return ii !== -1 ? ii : null;\n } else {\n ii = indexOf.call(this._longMonthsParse, llc);\n return ii !== -1 ? ii : null;\n }\n } else {\n if (format === 'MMM') {\n ii = indexOf.call(this._shortMonthsParse, llc);\n if (ii !== -1) {\n return ii;\n }\n ii = indexOf.call(this._longMonthsParse, llc);\n return ii !== -1 ? ii : null;\n } else {\n ii = indexOf.call(this._longMonthsParse, llc);\n if (ii !== -1) {\n return ii;\n }\n ii = indexOf.call(this._shortMonthsParse, llc);\n return ii !== -1 ? ii : null;\n }\n }\n }\n\n function localeMonthsParse(monthName, format, strict) {\n var i, mom, regex;\n\n if (this._monthsParseExact) {\n return handleStrictParse.call(this, monthName, format, strict);\n }\n\n if (!this._monthsParse) {\n this._monthsParse = [];\n this._longMonthsParse = [];\n this._shortMonthsParse = [];\n }\n\n // TODO: add sorting\n // Sorting makes sure if one month (or abbr) is a prefix of another\n // see sorting in computeMonthsParse\n for (i = 0; i < 12; i++) {\n // make the regex if we don't have it already\n mom = createUTC([2000, i]);\n if (strict && !this._longMonthsParse[i]) {\n this._longMonthsParse[i] = new RegExp(\n '^' + this.months(mom, '').replace('.', '') + '$',\n 'i'\n );\n this._shortMonthsParse[i] = new RegExp(\n '^' + this.monthsShort(mom, '').replace('.', '') + '$',\n 'i'\n );\n }\n if (!strict && !this._monthsParse[i]) {\n regex =\n '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, '');\n this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');\n }\n // test the regex\n if (\n strict &&\n format === 'MMMM' &&\n this._longMonthsParse[i].test(monthName)\n ) {\n return i;\n } else if (\n strict &&\n format === 'MMM' &&\n this._shortMonthsParse[i].test(monthName)\n ) {\n return i;\n } else if (!strict && this._monthsParse[i].test(monthName)) {\n return i;\n }\n }\n }\n\n // MOMENTS\n\n function setMonth(mom, value) {\n if (!mom.isValid()) {\n // No op\n return mom;\n }\n\n if (typeof value === 'string') {\n if (/^\\d+$/.test(value)) {\n value = toInt(value);\n } else {\n value = mom.localeData().monthsParse(value);\n // TODO: Another silent failure?\n if (!isNumber(value)) {\n return mom;\n }\n }\n }\n\n var month = value,\n date = mom.date();\n\n date = date < 29 ? date : Math.min(date, daysInMonth(mom.year(), month));\n void (mom._isUTC\n ? mom._d.setUTCMonth(month, date)\n : mom._d.setMonth(month, date));\n return mom;\n }\n\n function getSetMonth(value) {\n if (value != null) {\n setMonth(this, value);\n hooks.updateOffset(this, true);\n return this;\n } else {\n return get(this, 'Month');\n }\n }\n\n function getDaysInMonth() {\n return daysInMonth(this.year(), this.month());\n }\n\n function monthsShortRegex(isStrict) {\n if (this._monthsParseExact) {\n if (!hasOwnProp(this, '_monthsRegex')) {\n computeMonthsParse.call(this);\n }\n if (isStrict) {\n return this._monthsShortStrictRegex;\n } else {\n return this._monthsShortRegex;\n }\n } else {\n if (!hasOwnProp(this, '_monthsShortRegex')) {\n this._monthsShortRegex = defaultMonthsShortRegex;\n }\n return this._monthsShortStrictRegex && isStrict\n ? this._monthsShortStrictRegex\n : this._monthsShortRegex;\n }\n }\n\n function monthsRegex(isStrict) {\n if (this._monthsParseExact) {\n if (!hasOwnProp(this, '_monthsRegex')) {\n computeMonthsParse.call(this);\n }\n if (isStrict) {\n return this._monthsStrictRegex;\n } else {\n return this._monthsRegex;\n }\n } else {\n if (!hasOwnProp(this, '_monthsRegex')) {\n this._monthsRegex = defaultMonthsRegex;\n }\n return this._monthsStrictRegex && isStrict\n ? this._monthsStrictRegex\n : this._monthsRegex;\n }\n }\n\n function computeMonthsParse() {\n function cmpLenRev(a, b) {\n return b.length - a.length;\n }\n\n var shortPieces = [],\n longPieces = [],\n mixedPieces = [],\n i,\n mom,\n shortP,\n longP;\n for (i = 0; i < 12; i++) {\n // make the regex if we don't have it already\n mom = createUTC([2000, i]);\n shortP = regexEscape(this.monthsShort(mom, ''));\n longP = regexEscape(this.months(mom, ''));\n shortPieces.push(shortP);\n longPieces.push(longP);\n mixedPieces.push(longP);\n mixedPieces.push(shortP);\n }\n // Sorting makes sure if one month (or abbr) is a prefix of another it\n // will match the longer piece.\n shortPieces.sort(cmpLenRev);\n longPieces.sort(cmpLenRev);\n mixedPieces.sort(cmpLenRev);\n\n this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');\n this._monthsShortRegex = this._monthsRegex;\n this._monthsStrictRegex = new RegExp(\n '^(' + longPieces.join('|') + ')',\n 'i'\n );\n this._monthsShortStrictRegex = new RegExp(\n '^(' + shortPieces.join('|') + ')',\n 'i'\n );\n }\n\n function createDate(y, m, d, h, M, s, ms) {\n // can't just apply() to create a date:\n // https://stackoverflow.com/q/181348\n var date;\n // the date constructor remaps years 0-99 to 1900-1999\n if (y < 100 && y >= 0) {\n // preserve leap years using a full 400 year cycle, then reset\n date = new Date(y + 400, m, d, h, M, s, ms);\n if (isFinite(date.getFullYear())) {\n date.setFullYear(y);\n }\n } else {\n date = new Date(y, m, d, h, M, s, ms);\n }\n\n return date;\n }\n\n function createUTCDate(y) {\n var date, args;\n // the Date.UTC function remaps years 0-99 to 1900-1999\n if (y < 100 && y >= 0) {\n args = Array.prototype.slice.call(arguments);\n // preserve leap years using a full 400 year cycle, then reset\n args[0] = y + 400;\n date = new Date(Date.UTC.apply(null, args));\n if (isFinite(date.getUTCFullYear())) {\n date.setUTCFullYear(y);\n }\n } else {\n date = new Date(Date.UTC.apply(null, arguments));\n }\n\n return date;\n }\n\n // start-of-first-week - start-of-year\n function firstWeekOffset(year, dow, doy) {\n var // first-week day -- which january is always in the first week (4 for iso, 1 for other)\n fwd = 7 + dow - doy,\n // first-week day local weekday -- which local weekday is fwd\n fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7;\n\n return -fwdlw + fwd - 1;\n }\n\n // https://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday\n function dayOfYearFromWeeks(year, week, weekday, dow, doy) {\n var localWeekday = (7 + weekday - dow) % 7,\n weekOffset = firstWeekOffset(year, dow, doy),\n dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset,\n resYear,\n resDayOfYear;\n\n if (dayOfYear <= 0) {\n resYear = year - 1;\n resDayOfYear = daysInYear(resYear) + dayOfYear;\n } else if (dayOfYear > daysInYear(year)) {\n resYear = year + 1;\n resDayOfYear = dayOfYear - daysInYear(year);\n } else {\n resYear = year;\n resDayOfYear = dayOfYear;\n }\n\n return {\n year: resYear,\n dayOfYear: resDayOfYear,\n };\n }\n\n function weekOfYear(mom, dow, doy) {\n var weekOffset = firstWeekOffset(mom.year(), dow, doy),\n week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1,\n resWeek,\n resYear;\n\n if (week < 1) {\n resYear = mom.year() - 1;\n resWeek = week + weeksInYear(resYear, dow, doy);\n } else if (week > weeksInYear(mom.year(), dow, doy)) {\n resWeek = week - weeksInYear(mom.year(), dow, doy);\n resYear = mom.year() + 1;\n } else {\n resYear = mom.year();\n resWeek = week;\n }\n\n return {\n week: resWeek,\n year: resYear,\n };\n }\n\n function weeksInYear(year, dow, doy) {\n var weekOffset = firstWeekOffset(year, dow, doy),\n weekOffsetNext = firstWeekOffset(year + 1, dow, doy);\n return (daysInYear(year) - weekOffset + weekOffsetNext) / 7;\n }\n\n // FORMATTING\n\n addFormatToken('w', ['ww', 2], 'wo', 'week');\n addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek');\n\n // PARSING\n\n addRegexToken('w', match1to2, match1to2NoLeadingZero);\n addRegexToken('ww', match1to2, match2);\n addRegexToken('W', match1to2, match1to2NoLeadingZero);\n addRegexToken('WW', match1to2, match2);\n\n addWeekParseToken(\n ['w', 'ww', 'W', 'WW'],\n function (input, week, config, token) {\n week[token.substr(0, 1)] = toInt(input);\n }\n );\n\n // HELPERS\n\n // LOCALES\n\n function localeWeek(mom) {\n return weekOfYear(mom, this._week.dow, this._week.doy).week;\n }\n\n var defaultLocaleWeek = {\n dow: 0, // Sunday is the first day of the week.\n doy: 6, // The week that contains Jan 6th is the first week of the year.\n };\n\n function localeFirstDayOfWeek() {\n return this._week.dow;\n }\n\n function localeFirstDayOfYear() {\n return this._week.doy;\n }\n\n // MOMENTS\n\n function getSetWeek(input) {\n var week = this.localeData().week(this);\n return input == null ? week : this.add((input - week) * 7, 'd');\n }\n\n function getSetISOWeek(input) {\n var week = weekOfYear(this, 1, 4).week;\n return input == null ? week : this.add((input - week) * 7, 'd');\n }\n\n // FORMATTING\n\n addFormatToken('d', 0, 'do', 'day');\n\n addFormatToken('dd', 0, 0, function (format) {\n return this.localeData().weekdaysMin(this, format);\n });\n\n addFormatToken('ddd', 0, 0, function (format) {\n return this.localeData().weekdaysShort(this, format);\n });\n\n addFormatToken('dddd', 0, 0, function (format) {\n return this.localeData().weekdays(this, format);\n });\n\n addFormatToken('e', 0, 0, 'weekday');\n addFormatToken('E', 0, 0, 'isoWeekday');\n\n // PARSING\n\n addRegexToken('d', match1to2);\n addRegexToken('e', match1to2);\n addRegexToken('E', match1to2);\n addRegexToken('dd', function (isStrict, locale) {\n return locale.weekdaysMinRegex(isStrict);\n });\n addRegexToken('ddd', function (isStrict, locale) {\n return locale.weekdaysShortRegex(isStrict);\n });\n addRegexToken('dddd', function (isStrict, locale) {\n return locale.weekdaysRegex(isStrict);\n });\n\n addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) {\n var weekday = config._locale.weekdaysParse(input, token, config._strict);\n // if we didn't get a weekday name, mark the date as invalid\n if (weekday != null) {\n week.d = weekday;\n } else {\n getParsingFlags(config).invalidWeekday = input;\n }\n });\n\n addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) {\n week[token] = toInt(input);\n });\n\n // HELPERS\n\n function parseWeekday(input, locale) {\n if (typeof input !== 'string') {\n return input;\n }\n\n if (!isNaN(input)) {\n return parseInt(input, 10);\n }\n\n input = locale.weekdaysParse(input);\n if (typeof input === 'number') {\n return input;\n }\n\n return null;\n }\n\n function parseIsoWeekday(input, locale) {\n if (typeof input === 'string') {\n return locale.weekdaysParse(input) % 7 || 7;\n }\n return isNaN(input) ? null : input;\n }\n\n // LOCALES\n function shiftWeekdays(ws, n) {\n return ws.slice(n, 7).concat(ws.slice(0, n));\n }\n\n var defaultLocaleWeekdays =\n 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'),\n defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),\n defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),\n defaultWeekdaysRegex = matchWord,\n defaultWeekdaysShortRegex = matchWord,\n defaultWeekdaysMinRegex = matchWord;\n\n function localeWeekdays(m, format) {\n var weekdays = isArray(this._weekdays)\n ? this._weekdays\n : this._weekdays[\n m && m !== true && this._weekdays.isFormat.test(format)\n ? 'format'\n : 'standalone'\n ];\n return m === true\n ? shiftWeekdays(weekdays, this._week.dow)\n : m\n ? weekdays[m.day()]\n : weekdays;\n }\n\n function localeWeekdaysShort(m) {\n return m === true\n ? shiftWeekdays(this._weekdaysShort, this._week.dow)\n : m\n ? this._weekdaysShort[m.day()]\n : this._weekdaysShort;\n }\n\n function localeWeekdaysMin(m) {\n return m === true\n ? shiftWeekdays(this._weekdaysMin, this._week.dow)\n : m\n ? this._weekdaysMin[m.day()]\n : this._weekdaysMin;\n }\n\n function handleStrictParse$1(weekdayName, format, strict) {\n var i,\n ii,\n mom,\n llc = weekdayName.toLocaleLowerCase();\n if (!this._weekdaysParse) {\n this._weekdaysParse = [];\n this._shortWeekdaysParse = [];\n this._minWeekdaysParse = [];\n\n for (i = 0; i < 7; ++i) {\n mom = createUTC([2000, 1]).day(i);\n this._minWeekdaysParse[i] = this.weekdaysMin(\n mom,\n ''\n ).toLocaleLowerCase();\n this._shortWeekdaysParse[i] = this.weekdaysShort(\n mom,\n ''\n ).toLocaleLowerCase();\n this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase();\n }\n }\n\n if (strict) {\n if (format === 'dddd') {\n ii = indexOf.call(this._weekdaysParse, llc);\n return ii !== -1 ? ii : null;\n } else if (format === 'ddd') {\n ii = indexOf.call(this._shortWeekdaysParse, llc);\n return ii !== -1 ? ii : null;\n } else {\n ii = indexOf.call(this._minWeekdaysParse, llc);\n return ii !== -1 ? ii : null;\n }\n } else {\n if (format === 'dddd') {\n ii = indexOf.call(this._weekdaysParse, llc);\n if (ii !== -1) {\n return ii;\n }\n ii = indexOf.call(this._shortWeekdaysParse, llc);\n if (ii !== -1) {\n return ii;\n }\n ii = indexOf.call(this._minWeekdaysParse, llc);\n return ii !== -1 ? ii : null;\n } else if (format === 'ddd') {\n ii = indexOf.call(this._shortWeekdaysParse, llc);\n if (ii !== -1) {\n return ii;\n }\n ii = indexOf.call(this._weekdaysParse, llc);\n if (ii !== -1) {\n return ii;\n }\n ii = indexOf.call(this._minWeekdaysParse, llc);\n return ii !== -1 ? ii : null;\n } else {\n ii = indexOf.call(this._minWeekdaysParse, llc);\n if (ii !== -1) {\n return ii;\n }\n ii = indexOf.call(this._weekdaysParse, llc);\n if (ii !== -1) {\n return ii;\n }\n ii = indexOf.call(this._shortWeekdaysParse, llc);\n return ii !== -1 ? ii : null;\n }\n }\n }\n\n function localeWeekdaysParse(weekdayName, format, strict) {\n var i, mom, regex;\n\n if (this._weekdaysParseExact) {\n return handleStrictParse$1.call(this, weekdayName, format, strict);\n }\n\n if (!this._weekdaysParse) {\n this._weekdaysParse = [];\n this._minWeekdaysParse = [];\n this._shortWeekdaysParse = [];\n this._fullWeekdaysParse = [];\n }\n\n for (i = 0; i < 7; i++) {\n // make the regex if we don't have it already\n\n mom = createUTC([2000, 1]).day(i);\n if (strict && !this._fullWeekdaysParse[i]) {\n this._fullWeekdaysParse[i] = new RegExp(\n '^' + this.weekdays(mom, '').replace('.', '\\\\.?') + '$',\n 'i'\n );\n this._shortWeekdaysParse[i] = new RegExp(\n '^' + this.weekdaysShort(mom, '').replace('.', '\\\\.?') + '$',\n 'i'\n );\n this._minWeekdaysParse[i] = new RegExp(\n '^' + this.weekdaysMin(mom, '').replace('.', '\\\\.?') + '$',\n 'i'\n );\n }\n if (!this._weekdaysParse[i]) {\n regex =\n '^' +\n this.weekdays(mom, '') +\n '|^' +\n this.weekdaysShort(mom, '') +\n '|^' +\n this.weekdaysMin(mom, '');\n this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i');\n }\n // test the regex\n if (\n strict &&\n format === 'dddd' &&\n this._fullWeekdaysParse[i].test(weekdayName)\n ) {\n return i;\n } else if (\n strict &&\n format === 'ddd' &&\n this._shortWeekdaysParse[i].test(weekdayName)\n ) {\n return i;\n } else if (\n strict &&\n format === 'dd' &&\n this._minWeekdaysParse[i].test(weekdayName)\n ) {\n return i;\n } else if (!strict && this._weekdaysParse[i].test(weekdayName)) {\n return i;\n }\n }\n }\n\n // MOMENTS\n\n function getSetDayOfWeek(input) {\n if (!this.isValid()) {\n return input != null ? this : NaN;\n }\n\n var day = get(this, 'Day');\n if (input != null) {\n input = parseWeekday(input, this.localeData());\n return this.add(input - day, 'd');\n } else {\n return day;\n }\n }\n\n function getSetLocaleDayOfWeek(input) {\n if (!this.isValid()) {\n return input != null ? this : NaN;\n }\n var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7;\n return input == null ? weekday : this.add(input - weekday, 'd');\n }\n\n function getSetISODayOfWeek(input) {\n if (!this.isValid()) {\n return input != null ? this : NaN;\n }\n\n // behaves the same as moment#day except\n // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6)\n // as a setter, sunday should belong to the previous week.\n\n if (input != null) {\n var weekday = parseIsoWeekday(input, this.localeData());\n return this.day(this.day() % 7 ? weekday : weekday - 7);\n } else {\n return this.day() || 7;\n }\n }\n\n function weekdaysRegex(isStrict) {\n if (this._weekdaysParseExact) {\n if (!hasOwnProp(this, '_weekdaysRegex')) {\n computeWeekdaysParse.call(this);\n }\n if (isStrict) {\n return this._weekdaysStrictRegex;\n } else {\n return this._weekdaysRegex;\n }\n } else {\n if (!hasOwnProp(this, '_weekdaysRegex')) {\n this._weekdaysRegex = defaultWeekdaysRegex;\n }\n return this._weekdaysStrictRegex && isStrict\n ? this._weekdaysStrictRegex\n : this._weekdaysRegex;\n }\n }\n\n function weekdaysShortRegex(isStrict) {\n if (this._weekdaysParseExact) {\n if (!hasOwnProp(this, '_weekdaysRegex')) {\n computeWeekdaysParse.call(this);\n }\n if (isStrict) {\n return this._weekdaysShortStrictRegex;\n } else {\n return this._weekdaysShortRegex;\n }\n } else {\n if (!hasOwnProp(this, '_weekdaysShortRegex')) {\n this._weekdaysShortRegex = defaultWeekdaysShortRegex;\n }\n return this._weekdaysShortStrictRegex && isStrict\n ? this._weekdaysShortStrictRegex\n : this._weekdaysShortRegex;\n }\n }\n\n function weekdaysMinRegex(isStrict) {\n if (this._weekdaysParseExact) {\n if (!hasOwnProp(this, '_weekdaysRegex')) {\n computeWeekdaysParse.call(this);\n }\n if (isStrict) {\n return this._weekdaysMinStrictRegex;\n } else {\n return this._weekdaysMinRegex;\n }\n } else {\n if (!hasOwnProp(this, '_weekdaysMinRegex')) {\n this._weekdaysMinRegex = defaultWeekdaysMinRegex;\n }\n return this._weekdaysMinStrictRegex && isStrict\n ? this._weekdaysMinStrictRegex\n : this._weekdaysMinRegex;\n }\n }\n\n function computeWeekdaysParse() {\n function cmpLenRev(a, b) {\n return b.length - a.length;\n }\n\n var minPieces = [],\n shortPieces = [],\n longPieces = [],\n mixedPieces = [],\n i,\n mom,\n minp,\n shortp,\n longp;\n for (i = 0; i < 7; i++) {\n // make the regex if we don't have it already\n mom = createUTC([2000, 1]).day(i);\n minp = regexEscape(this.weekdaysMin(mom, ''));\n shortp = regexEscape(this.weekdaysShort(mom, ''));\n longp = regexEscape(this.weekdays(mom, ''));\n minPieces.push(minp);\n shortPieces.push(shortp);\n longPieces.push(longp);\n mixedPieces.push(minp);\n mixedPieces.push(shortp);\n mixedPieces.push(longp);\n }\n // Sorting makes sure if one weekday (or abbr) is a prefix of another it\n // will match the longer piece.\n minPieces.sort(cmpLenRev);\n shortPieces.sort(cmpLenRev);\n longPieces.sort(cmpLenRev);\n mixedPieces.sort(cmpLenRev);\n\n this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');\n this._weekdaysShortRegex = this._weekdaysRegex;\n this._weekdaysMinRegex = this._weekdaysRegex;\n\n this._weekdaysStrictRegex = new RegExp(\n '^(' + longPieces.join('|') + ')',\n 'i'\n );\n this._weekdaysShortStrictRegex = new RegExp(\n '^(' + shortPieces.join('|') + ')',\n 'i'\n );\n this._weekdaysMinStrictRegex = new RegExp(\n '^(' + minPieces.join('|') + ')',\n 'i'\n );\n }\n\n // FORMATTING\n\n function hFormat() {\n return this.hours() % 12 || 12;\n }\n\n function kFormat() {\n return this.hours() || 24;\n }\n\n addFormatToken('H', ['HH', 2], 0, 'hour');\n addFormatToken('h', ['hh', 2], 0, hFormat);\n addFormatToken('k', ['kk', 2], 0, kFormat);\n\n addFormatToken('hmm', 0, 0, function () {\n return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2);\n });\n\n addFormatToken('hmmss', 0, 0, function () {\n return (\n '' +\n hFormat.apply(this) +\n zeroFill(this.minutes(), 2) +\n zeroFill(this.seconds(), 2)\n );\n });\n\n addFormatToken('Hmm', 0, 0, function () {\n return '' + this.hours() + zeroFill(this.minutes(), 2);\n });\n\n addFormatToken('Hmmss', 0, 0, function () {\n return (\n '' +\n this.hours() +\n zeroFill(this.minutes(), 2) +\n zeroFill(this.seconds(), 2)\n );\n });\n\n function meridiem(token, lowercase) {\n addFormatToken(token, 0, 0, function () {\n return this.localeData().meridiem(\n this.hours(),\n this.minutes(),\n lowercase\n );\n });\n }\n\n meridiem('a', true);\n meridiem('A', false);\n\n // PARSING\n\n function matchMeridiem(isStrict, locale) {\n return locale._meridiemParse;\n }\n\n addRegexToken('a', matchMeridiem);\n addRegexToken('A', matchMeridiem);\n addRegexToken('H', match1to2, match1to2HasZero);\n addRegexToken('h', match1to2, match1to2NoLeadingZero);\n addRegexToken('k', match1to2, match1to2NoLeadingZero);\n addRegexToken('HH', match1to2, match2);\n addRegexToken('hh', match1to2, match2);\n addRegexToken('kk', match1to2, match2);\n\n addRegexToken('hmm', match3to4);\n addRegexToken('hmmss', match5to6);\n addRegexToken('Hmm', match3to4);\n addRegexToken('Hmmss', match5to6);\n\n addParseToken(['H', 'HH'], HOUR);\n addParseToken(['k', 'kk'], function (input, array, config) {\n var kInput = toInt(input);\n array[HOUR] = kInput === 24 ? 0 : kInput;\n });\n addParseToken(['a', 'A'], function (input, array, config) {\n config._isPm = config._locale.isPM(input);\n config._meridiem = input;\n });\n addParseToken(['h', 'hh'], function (input, array, config) {\n array[HOUR] = toInt(input);\n getParsingFlags(config).bigHour = true;\n });\n addParseToken('hmm', function (input, array, config) {\n var pos = input.length - 2;\n array[HOUR] = toInt(input.substr(0, pos));\n array[MINUTE] = toInt(input.substr(pos));\n getParsingFlags(config).bigHour = true;\n });\n addParseToken('hmmss', function (input, array, config) {\n var pos1 = input.length - 4,\n pos2 = input.length - 2;\n array[HOUR] = toInt(input.substr(0, pos1));\n array[MINUTE] = toInt(input.substr(pos1, 2));\n array[SECOND] = toInt(input.substr(pos2));\n getParsingFlags(config).bigHour = true;\n });\n addParseToken('Hmm', function (input, array, config) {\n var pos = input.length - 2;\n array[HOUR] = toInt(input.substr(0, pos));\n array[MINUTE] = toInt(input.substr(pos));\n });\n addParseToken('Hmmss', function (input, array, config) {\n var pos1 = input.length - 4,\n pos2 = input.length - 2;\n array[HOUR] = toInt(input.substr(0, pos1));\n array[MINUTE] = toInt(input.substr(pos1, 2));\n array[SECOND] = toInt(input.substr(pos2));\n });\n\n // LOCALES\n\n function localeIsPM(input) {\n // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays\n // Using charAt should be more compatible.\n return (input + '').toLowerCase().charAt(0) === 'p';\n }\n\n var defaultLocaleMeridiemParse = /[ap]\\.?m?\\.?/i,\n // Setting the hour should keep the time, because the user explicitly\n // specified which hour they want. So trying to maintain the same hour (in\n // a new timezone) makes sense. Adding/subtracting hours does not follow\n // this rule.\n getSetHour = makeGetSet('Hours', true);\n\n function localeMeridiem(hours, minutes, isLower) {\n if (hours > 11) {\n return isLower ? 'pm' : 'PM';\n } else {\n return isLower ? 'am' : 'AM';\n }\n }\n\n var baseConfig = {\n calendar: defaultCalendar,\n longDateFormat: defaultLongDateFormat,\n invalidDate: defaultInvalidDate,\n ordinal: defaultOrdinal,\n dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse,\n relativeTime: defaultRelativeTime,\n\n months: defaultLocaleMonths,\n monthsShort: defaultLocaleMonthsShort,\n\n week: defaultLocaleWeek,\n\n weekdays: defaultLocaleWeekdays,\n weekdaysMin: defaultLocaleWeekdaysMin,\n weekdaysShort: defaultLocaleWeekdaysShort,\n\n meridiemParse: defaultLocaleMeridiemParse,\n };\n\n // internal storage for locale config files\n var locales = {},\n localeFamilies = {},\n globalLocale;\n\n function commonPrefix(arr1, arr2) {\n var i,\n minl = Math.min(arr1.length, arr2.length);\n for (i = 0; i < minl; i += 1) {\n if (arr1[i] !== arr2[i]) {\n return i;\n }\n }\n return minl;\n }\n\n function normalizeLocale(key) {\n return key ? key.toLowerCase().replace('_', '-') : key;\n }\n\n // pick the locale from the array\n // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each\n // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root\n function chooseLocale(names) {\n var i = 0,\n j,\n next,\n locale,\n split;\n\n while (i < names.length) {\n split = normalizeLocale(names[i]).split('-');\n j = split.length;\n next = normalizeLocale(names[i + 1]);\n next = next ? next.split('-') : null;\n while (j > 0) {\n locale = loadLocale(split.slice(0, j).join('-'));\n if (locale) {\n return locale;\n }\n if (\n next &&\n next.length >= j &&\n commonPrefix(split, next) >= j - 1\n ) {\n //the next array item is better than a shallower substring of this one\n break;\n }\n j--;\n }\n i++;\n }\n return globalLocale;\n }\n\n function isLocaleNameSane(name) {\n // Prevent names that look like filesystem paths, i.e contain '/' or '\\'\n // Ensure name is available and function returns boolean\n return !!(name && name.match('^[^/\\\\\\\\]*$'));\n }\n\n function loadLocale(name) {\n var oldLocale = null,\n aliasedRequire;\n // TODO: Find a better way to register and load all the locales in Node\n if (\n locales[name] === undefined &&\n typeof module !== 'undefined' &&\n module &&\n module.exports &&\n isLocaleNameSane(name)\n ) {\n try {\n oldLocale = globalLocale._abbr;\n aliasedRequire = require;\n aliasedRequire('./locale/' + name);\n getSetGlobalLocale(oldLocale);\n } catch (e) {\n // mark as not found to avoid repeating expensive file require call causing high CPU\n // when trying to find en-US, en_US, en-us for every format call\n locales[name] = null; // null means not found\n }\n }\n return locales[name];\n }\n\n // This function will load locale and then set the global locale. If\n // no arguments are passed in, it will simply return the current global\n // locale key.\n function getSetGlobalLocale(key, values) {\n var data;\n if (key) {\n if (isUndefined(values)) {\n data = getLocale(key);\n } else {\n data = defineLocale(key, values);\n }\n\n if (data) {\n // moment.duration._locale = moment._locale = data;\n globalLocale = data;\n } else {\n if (typeof console !== 'undefined' && console.warn) {\n //warn user if arguments are passed but the locale could not be set\n console.warn(\n 'Locale ' + key + ' not found. Did you forget to load it?'\n );\n }\n }\n }\n\n return globalLocale._abbr;\n }\n\n function defineLocale(name, config) {\n if (config !== null) {\n var locale,\n parentConfig = baseConfig;\n config.abbr = name;\n if (locales[name] != null) {\n deprecateSimple(\n 'defineLocaleOverride',\n 'use moment.updateLocale(localeName, config) to change ' +\n 'an existing locale. moment.defineLocale(localeName, ' +\n 'config) should only be used for creating a new locale ' +\n 'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.'\n );\n parentConfig = locales[name]._config;\n } else if (config.parentLocale != null) {\n if (locales[config.parentLocale] != null) {\n parentConfig = locales[config.parentLocale]._config;\n } else {\n locale = loadLocale(config.parentLocale);\n if (locale != null) {\n parentConfig = locale._config;\n } else {\n if (!localeFamilies[config.parentLocale]) {\n localeFamilies[config.parentLocale] = [];\n }\n localeFamilies[config.parentLocale].push({\n name: name,\n config: config,\n });\n return null;\n }\n }\n }\n locales[name] = new Locale(mergeConfigs(parentConfig, config));\n\n if (localeFamilies[name]) {\n localeFamilies[name].forEach(function (x) {\n defineLocale(x.name, x.config);\n });\n }\n\n // backwards compat for now: also set the locale\n // make sure we set the locale AFTER all child locales have been\n // created, so we won't end up with the child locale set.\n getSetGlobalLocale(name);\n\n return locales[name];\n } else {\n // useful for testing\n delete locales[name];\n return null;\n }\n }\n\n function updateLocale(name, config) {\n if (config != null) {\n var locale,\n tmpLocale,\n parentConfig = baseConfig;\n\n if (locales[name] != null && locales[name].parentLocale != null) {\n // Update existing child locale in-place to avoid memory-leaks\n locales[name].set(mergeConfigs(locales[name]._config, config));\n } else {\n // MERGE\n tmpLocale = loadLocale(name);\n if (tmpLocale != null) {\n parentConfig = tmpLocale._config;\n }\n config = mergeConfigs(parentConfig, config);\n if (tmpLocale == null) {\n // updateLocale is called for creating a new locale\n // Set abbr so it will have a name (getters return\n // undefined otherwise).\n config.abbr = name;\n }\n locale = new Locale(config);\n locale.parentLocale = locales[name];\n locales[name] = locale;\n }\n\n // backwards compat for now: also set the locale\n getSetGlobalLocale(name);\n } else {\n // pass null for config to unupdate, useful for tests\n if (locales[name] != null) {\n if (locales[name].parentLocale != null) {\n locales[name] = locales[name].parentLocale;\n if (name === getSetGlobalLocale()) {\n getSetGlobalLocale(name);\n }\n } else if (locales[name] != null) {\n delete locales[name];\n }\n }\n }\n return locales[name];\n }\n\n // returns locale data\n function getLocale(key) {\n var locale;\n\n if (key && key._locale && key._locale._abbr) {\n key = key._locale._abbr;\n }\n\n if (!key) {\n return globalLocale;\n }\n\n if (!isArray(key)) {\n //short-circuit everything else\n locale = loadLocale(key);\n if (locale) {\n return locale;\n }\n key = [key];\n }\n\n return chooseLocale(key);\n }\n\n function listLocales() {\n return keys(locales);\n }\n\n function checkOverflow(m) {\n var overflow,\n a = m._a;\n\n if (a && getParsingFlags(m).overflow === -2) {\n overflow =\n a[MONTH] < 0 || a[MONTH] > 11\n ? MONTH\n : a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH])\n ? DATE\n : a[HOUR] < 0 ||\n a[HOUR] > 24 ||\n (a[HOUR] === 24 &&\n (a[MINUTE] !== 0 ||\n a[SECOND] !== 0 ||\n a[MILLISECOND] !== 0))\n ? HOUR\n : a[MINUTE] < 0 || a[MINUTE] > 59\n ? MINUTE\n : a[SECOND] < 0 || a[SECOND] > 59\n ? SECOND\n : a[MILLISECOND] < 0 || a[MILLISECOND] > 999\n ? MILLISECOND\n : -1;\n\n if (\n getParsingFlags(m)._overflowDayOfYear &&\n (overflow < YEAR || overflow > DATE)\n ) {\n overflow = DATE;\n }\n if (getParsingFlags(m)._overflowWeeks && overflow === -1) {\n overflow = WEEK;\n }\n if (getParsingFlags(m)._overflowWeekday && overflow === -1) {\n overflow = WEEKDAY;\n }\n\n getParsingFlags(m).overflow = overflow;\n }\n\n return m;\n }\n\n // iso 8601 regex\n // 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00)\n var extendedIsoRegex =\n /^\\s*((?:[+-]\\d{6}|\\d{4})-(?:\\d\\d-\\d\\d|W\\d\\d-\\d|W\\d\\d|\\d\\d\\d|\\d\\d))(?:(T| )(\\d\\d(?::\\d\\d(?::\\d\\d(?:[.,]\\d+)?)?)?)([+-]\\d\\d(?::?\\d\\d)?|\\s*Z)?)?$/,\n basicIsoRegex =\n /^\\s*((?:[+-]\\d{6}|\\d{4})(?:\\d\\d\\d\\d|W\\d\\d\\d|W\\d\\d|\\d\\d\\d|\\d\\d|))(?:(T| )(\\d\\d(?:\\d\\d(?:\\d\\d(?:[.,]\\d+)?)?)?)([+-]\\d\\d(?::?\\d\\d)?|\\s*Z)?)?$/,\n tzRegex = /Z|[+-]\\d\\d(?::?\\d\\d)?/,\n isoDates = [\n ['YYYYYY-MM-DD', /[+-]\\d{6}-\\d\\d-\\d\\d/],\n ['YYYY-MM-DD', /\\d{4}-\\d\\d-\\d\\d/],\n ['GGGG-[W]WW-E', /\\d{4}-W\\d\\d-\\d/],\n ['GGGG-[W]WW', /\\d{4}-W\\d\\d/, false],\n ['YYYY-DDD', /\\d{4}-\\d{3}/],\n ['YYYY-MM', /\\d{4}-\\d\\d/, false],\n ['YYYYYYMMDD', /[+-]\\d{10}/],\n ['YYYYMMDD', /\\d{8}/],\n ['GGGG[W]WWE', /\\d{4}W\\d{3}/],\n ['GGGG[W]WW', /\\d{4}W\\d{2}/, false],\n ['YYYYDDD', /\\d{7}/],\n ['YYYYMM', /\\d{6}/, false],\n ['YYYY', /\\d{4}/, false],\n ],\n // iso time formats and regexes\n isoTimes = [\n ['HH:mm:ss.SSSS', /\\d\\d:\\d\\d:\\d\\d\\.\\d+/],\n ['HH:mm:ss,SSSS', /\\d\\d:\\d\\d:\\d\\d,\\d+/],\n ['HH:mm:ss', /\\d\\d:\\d\\d:\\d\\d/],\n ['HH:mm', /\\d\\d:\\d\\d/],\n ['HHmmss.SSSS', /\\d\\d\\d\\d\\d\\d\\.\\d+/],\n ['HHmmss,SSSS', /\\d\\d\\d\\d\\d\\d,\\d+/],\n ['HHmmss', /\\d\\d\\d\\d\\d\\d/],\n ['HHmm', /\\d\\d\\d\\d/],\n ['HH', /\\d\\d/],\n ],\n aspNetJsonRegex = /^\\/?Date\\((-?\\d+)/i,\n // RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3\n rfc2822 =\n /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\\s)?(\\d{1,2})\\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\\s(\\d{2,4})\\s(\\d\\d):(\\d\\d)(?::(\\d\\d))?\\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\\d{4}))$/,\n obsOffsets = {\n UT: 0,\n GMT: 0,\n EDT: -4 * 60,\n EST: -5 * 60,\n CDT: -5 * 60,\n CST: -6 * 60,\n MDT: -6 * 60,\n MST: -7 * 60,\n PDT: -7 * 60,\n PST: -8 * 60,\n };\n\n // date from iso format\n function configFromISO(config) {\n var i,\n l,\n string = config._i,\n match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string),\n allowTime,\n dateFormat,\n timeFormat,\n tzFormat,\n isoDatesLen = isoDates.length,\n isoTimesLen = isoTimes.length;\n\n if (match) {\n getParsingFlags(config).iso = true;\n for (i = 0, l = isoDatesLen; i < l; i++) {\n if (isoDates[i][1].exec(match[1])) {\n dateFormat = isoDates[i][0];\n allowTime = isoDates[i][2] !== false;\n break;\n }\n }\n if (dateFormat == null) {\n config._isValid = false;\n return;\n }\n if (match[3]) {\n for (i = 0, l = isoTimesLen; i < l; i++) {\n if (isoTimes[i][1].exec(match[3])) {\n // match[2] should be 'T' or space\n timeFormat = (match[2] || ' ') + isoTimes[i][0];\n break;\n }\n }\n if (timeFormat == null) {\n config._isValid = false;\n return;\n }\n }\n if (!allowTime && timeFormat != null) {\n config._isValid = false;\n return;\n }\n if (match[4]) {\n if (tzRegex.exec(match[4])) {\n tzFormat = 'Z';\n } else {\n config._isValid = false;\n return;\n }\n }\n config._f = dateFormat + (timeFormat || '') + (tzFormat || '');\n configFromStringAndFormat(config);\n } else {\n config._isValid = false;\n }\n }\n\n function extractFromRFC2822Strings(\n yearStr,\n monthStr,\n dayStr,\n hourStr,\n minuteStr,\n secondStr\n ) {\n var result = [\n untruncateYear(yearStr),\n defaultLocaleMonthsShort.indexOf(monthStr),\n parseInt(dayStr, 10),\n parseInt(hourStr, 10),\n parseInt(minuteStr, 10),\n ];\n\n if (secondStr) {\n result.push(parseInt(secondStr, 10));\n }\n\n return result;\n }\n\n function untruncateYear(yearStr) {\n var year = parseInt(yearStr, 10);\n if (year <= 49) {\n return 2000 + year;\n } else if (year <= 999) {\n return 1900 + year;\n }\n return year;\n }\n\n function preprocessRFC2822(s) {\n // Remove comments and folding whitespace and replace multiple-spaces with a single space\n return s\n .replace(/\\([^()]*\\)|[\\n\\t]/g, ' ')\n .replace(/(\\s\\s+)/g, ' ')\n .replace(/^\\s\\s*/, '')\n .replace(/\\s\\s*$/, '');\n }\n\n function checkWeekday(weekdayStr, parsedInput, config) {\n if (weekdayStr) {\n // TODO: Replace the vanilla JS Date object with an independent day-of-week check.\n var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr),\n weekdayActual = new Date(\n parsedInput[0],\n parsedInput[1],\n parsedInput[2]\n ).getDay();\n if (weekdayProvided !== weekdayActual) {\n getParsingFlags(config).weekdayMismatch = true;\n config._isValid = false;\n return false;\n }\n }\n return true;\n }\n\n function calculateOffset(obsOffset, militaryOffset, numOffset) {\n if (obsOffset) {\n return obsOffsets[obsOffset];\n } else if (militaryOffset) {\n // the only allowed military tz is Z\n return 0;\n } else {\n var hm = parseInt(numOffset, 10),\n m = hm % 100,\n h = (hm - m) / 100;\n return h * 60 + m;\n }\n }\n\n // date and time from ref 2822 format\n function configFromRFC2822(config) {\n var match = rfc2822.exec(preprocessRFC2822(config._i)),\n parsedArray;\n if (match) {\n parsedArray = extractFromRFC2822Strings(\n match[4],\n match[3],\n match[2],\n match[5],\n match[6],\n match[7]\n );\n if (!checkWeekday(match[1], parsedArray, config)) {\n return;\n }\n\n config._a = parsedArray;\n config._tzm = calculateOffset(match[8], match[9], match[10]);\n\n config._d = createUTCDate.apply(null, config._a);\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n\n getParsingFlags(config).rfc2822 = true;\n } else {\n config._isValid = false;\n }\n }\n\n // date from 1) ASP.NET, 2) ISO, 3) RFC 2822 formats, or 4) optional fallback if parsing isn't strict\n function configFromString(config) {\n var matched = aspNetJsonRegex.exec(config._i);\n if (matched !== null) {\n config._d = new Date(+matched[1]);\n return;\n }\n\n configFromISO(config);\n if (config._isValid === false) {\n delete config._isValid;\n } else {\n return;\n }\n\n configFromRFC2822(config);\n if (config._isValid === false) {\n delete config._isValid;\n } else {\n return;\n }\n\n if (config._strict) {\n config._isValid = false;\n } else {\n // Final attempt, use Input Fallback\n hooks.createFromInputFallback(config);\n }\n }\n\n hooks.createFromInputFallback = deprecate(\n 'value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' +\n 'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' +\n 'discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.',\n function (config) {\n config._d = new Date(config._i + (config._useUTC ? ' UTC' : ''));\n }\n );\n\n // Pick the first defined of two or three arguments.\n function defaults(a, b, c) {\n if (a != null) {\n return a;\n }\n if (b != null) {\n return b;\n }\n return c;\n }\n\n function currentDateArray(config) {\n // hooks is actually the exported moment object\n var nowValue = new Date(hooks.now());\n if (config._useUTC) {\n return [\n nowValue.getUTCFullYear(),\n nowValue.getUTCMonth(),\n nowValue.getUTCDate(),\n ];\n }\n return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()];\n }\n\n // convert an array to a date.\n // the array should mirror the parameters below\n // note: all values past the year are optional and will default to the lowest possible value.\n // [year, month, day , hour, minute, second, millisecond]\n function configFromArray(config) {\n var i,\n date,\n input = [],\n currentDate,\n expectedWeekday,\n yearToUse;\n\n if (config._d) {\n return;\n }\n\n currentDate = currentDateArray(config);\n\n //compute day of the year from weeks and weekdays\n if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {\n dayOfYearFromWeekInfo(config);\n }\n\n //if the day of the year is set, figure out what it is\n if (config._dayOfYear != null) {\n yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);\n\n if (\n config._dayOfYear > daysInYear(yearToUse) ||\n config._dayOfYear === 0\n ) {\n getParsingFlags(config)._overflowDayOfYear = true;\n }\n\n date = createUTCDate(yearToUse, 0, config._dayOfYear);\n config._a[MONTH] = date.getUTCMonth();\n config._a[DATE] = date.getUTCDate();\n }\n\n // Default to current date.\n // * if no year, month, day of month are given, default to today\n // * if day of month is given, default month and year\n // * if month is given, default only year\n // * if year is given, don't default anything\n for (i = 0; i < 3 && config._a[i] == null; ++i) {\n config._a[i] = input[i] = currentDate[i];\n }\n\n // Zero out whatever was not defaulted, including time\n for (; i < 7; i++) {\n config._a[i] = input[i] =\n config._a[i] == null ? (i === 2 ? 1 : 0) : config._a[i];\n }\n\n // Check for 24:00:00.000\n if (\n config._a[HOUR] === 24 &&\n config._a[MINUTE] === 0 &&\n config._a[SECOND] === 0 &&\n config._a[MILLISECOND] === 0\n ) {\n config._nextDay = true;\n config._a[HOUR] = 0;\n }\n\n config._d = (config._useUTC ? createUTCDate : createDate).apply(\n null,\n input\n );\n expectedWeekday = config._useUTC\n ? config._d.getUTCDay()\n : config._d.getDay();\n\n // Apply timezone offset from input. The actual utcOffset can be changed\n // with parseZone.\n if (config._tzm != null) {\n config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);\n }\n\n if (config._nextDay) {\n config._a[HOUR] = 24;\n }\n\n // check for mismatching day of week\n if (\n config._w &&\n typeof config._w.d !== 'undefined' &&\n config._w.d !== expectedWeekday\n ) {\n getParsingFlags(config).weekdayMismatch = true;\n }\n }\n\n function dayOfYearFromWeekInfo(config) {\n var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow, curWeek;\n\n w = config._w;\n if (w.GG != null || w.W != null || w.E != null) {\n dow = 1;\n doy = 4;\n\n // TODO: We need to take the current isoWeekYear, but that depends on\n // how we interpret now (local, utc, fixed offset). So create\n // a now version of current config (take local/utc/offset flags, and\n // create now).\n weekYear = defaults(\n w.GG,\n config._a[YEAR],\n weekOfYear(createLocal(), 1, 4).year\n );\n week = defaults(w.W, 1);\n weekday = defaults(w.E, 1);\n if (weekday < 1 || weekday > 7) {\n weekdayOverflow = true;\n }\n } else {\n dow = config._locale._week.dow;\n doy = config._locale._week.doy;\n\n curWeek = weekOfYear(createLocal(), dow, doy);\n\n weekYear = defaults(w.gg, config._a[YEAR], curWeek.year);\n\n // Default to current week.\n week = defaults(w.w, curWeek.week);\n\n if (w.d != null) {\n // weekday -- low day numbers are considered next week\n weekday = w.d;\n if (weekday < 0 || weekday > 6) {\n weekdayOverflow = true;\n }\n } else if (w.e != null) {\n // local weekday -- counting starts from beginning of week\n weekday = w.e + dow;\n if (w.e < 0 || w.e > 6) {\n weekdayOverflow = true;\n }\n } else {\n // default to beginning of week\n weekday = dow;\n }\n }\n if (week < 1 || week > weeksInYear(weekYear, dow, doy)) {\n getParsingFlags(config)._overflowWeeks = true;\n } else if (weekdayOverflow != null) {\n getParsingFlags(config)._overflowWeekday = true;\n } else {\n temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy);\n config._a[YEAR] = temp.year;\n config._dayOfYear = temp.dayOfYear;\n }\n }\n\n // constant that refers to the ISO standard\n hooks.ISO_8601 = function () {};\n\n // constant that refers to the RFC 2822 form\n hooks.RFC_2822 = function () {};\n\n // date from string and format string\n function configFromStringAndFormat(config) {\n // TODO: Move this to another part of the creation flow to prevent circular deps\n if (config._f === hooks.ISO_8601) {\n configFromISO(config);\n return;\n }\n if (config._f === hooks.RFC_2822) {\n configFromRFC2822(config);\n return;\n }\n config._a = [];\n getParsingFlags(config).empty = true;\n\n // This array is used to make a Date, either with `new Date` or `Date.UTC`\n var string = '' + config._i,\n i,\n parsedInput,\n tokens,\n token,\n skipped,\n stringLength = string.length,\n totalParsedInputLength = 0,\n era,\n tokenLen;\n\n tokens =\n expandFormat(config._f, config._locale).match(formattingTokens) || [];\n tokenLen = tokens.length;\n for (i = 0; i < tokenLen; i++) {\n token = tokens[i];\n parsedInput = (string.match(getParseRegexForToken(token, config)) ||\n [])[0];\n if (parsedInput) {\n skipped = string.substr(0, string.indexOf(parsedInput));\n if (skipped.length > 0) {\n getParsingFlags(config).unusedInput.push(skipped);\n }\n string = string.slice(\n string.indexOf(parsedInput) + parsedInput.length\n );\n totalParsedInputLength += parsedInput.length;\n }\n // don't parse if it's not a known token\n if (formatTokenFunctions[token]) {\n if (parsedInput) {\n getParsingFlags(config).empty = false;\n } else {\n getParsingFlags(config).unusedTokens.push(token);\n }\n addTimeToArrayFromToken(token, parsedInput, config);\n } else if (config._strict && !parsedInput) {\n getParsingFlags(config).unusedTokens.push(token);\n }\n }\n\n // add remaining unparsed input length to the string\n getParsingFlags(config).charsLeftOver =\n stringLength - totalParsedInputLength;\n if (string.length > 0) {\n getParsingFlags(config).unusedInput.push(string);\n }\n\n // clear _12h flag if hour is <= 12\n if (\n config._a[HOUR] <= 12 &&\n getParsingFlags(config).bigHour === true &&\n config._a[HOUR] > 0\n ) {\n getParsingFlags(config).bigHour = undefined;\n }\n\n getParsingFlags(config).parsedDateParts = config._a.slice(0);\n getParsingFlags(config).meridiem = config._meridiem;\n // handle meridiem\n config._a[HOUR] = meridiemFixWrap(\n config._locale,\n config._a[HOUR],\n config._meridiem\n );\n\n // handle era\n era = getParsingFlags(config).era;\n if (era !== null) {\n config._a[YEAR] = config._locale.erasConvertYear(era, config._a[YEAR]);\n }\n\n configFromArray(config);\n checkOverflow(config);\n }\n\n function meridiemFixWrap(locale, hour, meridiem) {\n var isPm;\n\n if (meridiem == null) {\n // nothing to do\n return hour;\n }\n if (locale.meridiemHour != null) {\n return locale.meridiemHour(hour, meridiem);\n } else if (locale.isPM != null) {\n // Fallback\n isPm = locale.isPM(meridiem);\n if (isPm && hour < 12) {\n hour += 12;\n }\n if (!isPm && hour === 12) {\n hour = 0;\n }\n return hour;\n } else {\n // this is not supposed to happen\n return hour;\n }\n }\n\n // date from string and array of format strings\n function configFromStringAndArray(config) {\n var tempConfig,\n bestMoment,\n scoreToBeat,\n i,\n currentScore,\n validFormatFound,\n bestFormatIsValid = false,\n configfLen = config._f.length;\n\n if (configfLen === 0) {\n getParsingFlags(config).invalidFormat = true;\n config._d = new Date(NaN);\n return;\n }\n\n for (i = 0; i < configfLen; i++) {\n currentScore = 0;\n validFormatFound = false;\n tempConfig = copyConfig({}, config);\n if (config._useUTC != null) {\n tempConfig._useUTC = config._useUTC;\n }\n tempConfig._f = config._f[i];\n configFromStringAndFormat(tempConfig);\n\n if (isValid(tempConfig)) {\n validFormatFound = true;\n }\n\n // if there is any input that was not parsed add a penalty for that format\n currentScore += getParsingFlags(tempConfig).charsLeftOver;\n\n //or tokens\n currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10;\n\n getParsingFlags(tempConfig).score = currentScore;\n\n if (!bestFormatIsValid) {\n if (\n scoreToBeat == null ||\n currentScore < scoreToBeat ||\n validFormatFound\n ) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n if (validFormatFound) {\n bestFormatIsValid = true;\n }\n }\n } else {\n if (currentScore < scoreToBeat) {\n scoreToBeat = currentScore;\n bestMoment = tempConfig;\n }\n }\n }\n\n extend(config, bestMoment || tempConfig);\n }\n\n function configFromObject(config) {\n if (config._d) {\n return;\n }\n\n var i = normalizeObjectUnits(config._i),\n dayOrDate = i.day === undefined ? i.date : i.day;\n config._a = map(\n [i.year, i.month, dayOrDate, i.hour, i.minute, i.second, i.millisecond],\n function (obj) {\n return obj && parseInt(obj, 10);\n }\n );\n\n configFromArray(config);\n }\n\n function createFromConfig(config) {\n var res = new Moment(checkOverflow(prepareConfig(config)));\n if (res._nextDay) {\n // Adding is smart enough around DST\n res.add(1, 'd');\n res._nextDay = undefined;\n }\n\n return res;\n }\n\n function prepareConfig(config) {\n var input = config._i,\n format = config._f;\n\n config._locale = config._locale || getLocale(config._l);\n\n if (input === null || (format === undefined && input === '')) {\n return createInvalid({ nullInput: true });\n }\n\n if (typeof input === 'string') {\n config._i = input = config._locale.preparse(input);\n }\n\n if (isMoment(input)) {\n return new Moment(checkOverflow(input));\n } else if (isDate(input)) {\n config._d = input;\n } else if (isArray(format)) {\n configFromStringAndArray(config);\n } else if (format) {\n configFromStringAndFormat(config);\n } else {\n configFromInput(config);\n }\n\n if (!isValid(config)) {\n config._d = null;\n }\n\n return config;\n }\n\n function configFromInput(config) {\n var input = config._i;\n if (isUndefined(input)) {\n config._d = new Date(hooks.now());\n } else if (isDate(input)) {\n config._d = new Date(input.valueOf());\n } else if (typeof input === 'string') {\n configFromString(config);\n } else if (isArray(input)) {\n config._a = map(input.slice(0), function (obj) {\n return parseInt(obj, 10);\n });\n configFromArray(config);\n } else if (isObject(input)) {\n configFromObject(config);\n } else if (isNumber(input)) {\n // from milliseconds\n config._d = new Date(input);\n } else {\n hooks.createFromInputFallback(config);\n }\n }\n\n function createLocalOrUTC(input, format, locale, strict, isUTC) {\n var c = {};\n\n if (format === true || format === false) {\n strict = format;\n format = undefined;\n }\n\n if (locale === true || locale === false) {\n strict = locale;\n locale = undefined;\n }\n\n if (\n (isObject(input) && isObjectEmpty(input)) ||\n (isArray(input) && input.length === 0)\n ) {\n input = undefined;\n }\n // object construction must be done this way.\n // https://github.com/moment/moment/issues/1423\n c._isAMomentObject = true;\n c._useUTC = c._isUTC = isUTC;\n c._l = locale;\n c._i = input;\n c._f = format;\n c._strict = strict;\n\n return createFromConfig(c);\n }\n\n function createLocal(input, format, locale, strict) {\n return createLocalOrUTC(input, format, locale, strict, false);\n }\n\n var prototypeMin = deprecate(\n 'moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/',\n function () {\n var other = createLocal.apply(null, arguments);\n if (this.isValid() && other.isValid()) {\n return other < this ? this : other;\n } else {\n return createInvalid();\n }\n }\n ),\n prototypeMax = deprecate(\n 'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/',\n function () {\n var other = createLocal.apply(null, arguments);\n if (this.isValid() && other.isValid()) {\n return other > this ? this : other;\n } else {\n return createInvalid();\n }\n }\n );\n\n // Pick a moment m from moments so that m[fn](other) is true for all\n // other. This relies on the function fn to be transitive.\n //\n // moments should either be an array of moment objects or an array, whose\n // first element is an array of moment objects.\n function pickBy(fn, moments) {\n var res, i;\n if (moments.length === 1 && isArray(moments[0])) {\n moments = moments[0];\n }\n if (!moments.length) {\n return createLocal();\n }\n res = moments[0];\n for (i = 1; i < moments.length; ++i) {\n if (!moments[i].isValid() || moments[i][fn](res)) {\n res = moments[i];\n }\n }\n return res;\n }\n\n // TODO: Use [].sort instead?\n function min() {\n var args = [].slice.call(arguments, 0);\n\n return pickBy('isBefore', args);\n }\n\n function max() {\n var args = [].slice.call(arguments, 0);\n\n return pickBy('isAfter', args);\n }\n\n var now = function () {\n return Date.now ? Date.now() : +new Date();\n };\n\n var ordering = [\n 'year',\n 'quarter',\n 'month',\n 'week',\n 'day',\n 'hour',\n 'minute',\n 'second',\n 'millisecond',\n ];\n\n function isDurationValid(m) {\n var key,\n unitHasDecimal = false,\n i,\n orderLen = ordering.length;\n for (key in m) {\n if (\n hasOwnProp(m, key) &&\n !(\n indexOf.call(ordering, key) !== -1 &&\n (m[key] == null || !isNaN(m[key]))\n )\n ) {\n return false;\n }\n }\n\n for (i = 0; i < orderLen; ++i) {\n if (m[ordering[i]]) {\n if (unitHasDecimal) {\n return false; // only allow non-integers for smallest unit\n }\n if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) {\n unitHasDecimal = true;\n }\n }\n }\n\n return true;\n }\n\n function isValid$1() {\n return this._isValid;\n }\n\n function createInvalid$1() {\n return createDuration(NaN);\n }\n\n function Duration(duration) {\n var normalizedInput = normalizeObjectUnits(duration),\n years = normalizedInput.year || 0,\n quarters = normalizedInput.quarter || 0,\n months = normalizedInput.month || 0,\n weeks = normalizedInput.week || normalizedInput.isoWeek || 0,\n days = normalizedInput.day || 0,\n hours = normalizedInput.hour || 0,\n minutes = normalizedInput.minute || 0,\n seconds = normalizedInput.second || 0,\n milliseconds = normalizedInput.millisecond || 0;\n\n this._isValid = isDurationValid(normalizedInput);\n\n // representation for dateAddRemove\n this._milliseconds =\n +milliseconds +\n seconds * 1e3 + // 1000\n minutes * 6e4 + // 1000 * 60\n hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978\n // Because of dateAddRemove treats 24 hours as different from a\n // day when working around DST, we need to store them separately\n this._days = +days + weeks * 7;\n // It is impossible to translate months into days without knowing\n // which months you are are talking about, so we have to store\n // it separately.\n this._months = +months + quarters * 3 + years * 12;\n\n this._data = {};\n\n this._locale = getLocale();\n\n this._bubble();\n }\n\n function isDuration(obj) {\n return obj instanceof Duration;\n }\n\n function absRound(number) {\n if (number < 0) {\n return Math.round(-1 * number) * -1;\n } else {\n return Math.round(number);\n }\n }\n\n // compare two arrays, return the number of differences\n function compareArrays(array1, array2, dontConvert) {\n var len = Math.min(array1.length, array2.length),\n lengthDiff = Math.abs(array1.length - array2.length),\n diffs = 0,\n i;\n for (i = 0; i < len; i++) {\n if (\n (dontConvert && array1[i] !== array2[i]) ||\n (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))\n ) {\n diffs++;\n }\n }\n return diffs + lengthDiff;\n }\n\n // FORMATTING\n\n function offset(token, separator) {\n addFormatToken(token, 0, 0, function () {\n var offset = this.utcOffset(),\n sign = '+';\n if (offset < 0) {\n offset = -offset;\n sign = '-';\n }\n return (\n sign +\n zeroFill(~~(offset / 60), 2) +\n separator +\n zeroFill(~~offset % 60, 2)\n );\n });\n }\n\n offset('Z', ':');\n offset('ZZ', '');\n\n // PARSING\n\n addRegexToken('Z', matchShortOffset);\n addRegexToken('ZZ', matchShortOffset);\n addParseToken(['Z', 'ZZ'], function (input, array, config) {\n config._useUTC = true;\n config._tzm = offsetFromString(matchShortOffset, input);\n });\n\n // HELPERS\n\n // timezone chunker\n // '+10:00' > ['10', '00']\n // '-1530' > ['-15', '30']\n var chunkOffset = /([\\+\\-]|\\d\\d)/gi;\n\n function offsetFromString(matcher, string) {\n var matches = (string || '').match(matcher),\n chunk,\n parts,\n minutes;\n\n if (matches === null) {\n return null;\n }\n\n chunk = matches[matches.length - 1] || [];\n parts = (chunk + '').match(chunkOffset) || ['-', 0, 0];\n minutes = +(parts[1] * 60) + toInt(parts[2]);\n\n return minutes === 0 ? 0 : parts[0] === '+' ? minutes : -minutes;\n }\n\n // Return a moment from input, that is local/utc/zone equivalent to model.\n function cloneWithOffset(input, model) {\n var res, diff;\n if (model._isUTC) {\n res = model.clone();\n diff =\n (isMoment(input) || isDate(input)\n ? input.valueOf()\n : createLocal(input).valueOf()) - res.valueOf();\n // Use low-level api, because this fn is low-level api.\n res._d.setTime(res._d.valueOf() + diff);\n hooks.updateOffset(res, false);\n return res;\n } else {\n return createLocal(input).local();\n }\n }\n\n function getDateOffset(m) {\n // On Firefox.24 Date#getTimezoneOffset returns a floating point.\n // https://github.com/moment/moment/pull/1871\n return -Math.round(m._d.getTimezoneOffset());\n }\n\n // HOOKS\n\n // This function will be called whenever a moment is mutated.\n // It is intended to keep the offset in sync with the timezone.\n hooks.updateOffset = function () {};\n\n // MOMENTS\n\n // keepLocalTime = true means only change the timezone, without\n // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]-->\n // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset\n // +0200, so we adjust the time as needed, to be valid.\n //\n // Keeping the time actually adds/subtracts (one hour)\n // from the actual represented time. That is why we call updateOffset\n // a second time. In case it wants us to change the offset again\n // _changeInProgress == true case, then we have to adjust, because\n // there is no such time in the given timezone.\n function getSetOffset(input, keepLocalTime, keepMinutes) {\n var offset = this._offset || 0,\n localAdjust;\n if (!this.isValid()) {\n return input != null ? this : NaN;\n }\n if (input != null) {\n if (typeof input === 'string') {\n input = offsetFromString(matchShortOffset, input);\n if (input === null) {\n return this;\n }\n } else if (Math.abs(input) < 16 && !keepMinutes) {\n input = input * 60;\n }\n if (!this._isUTC && keepLocalTime) {\n localAdjust = getDateOffset(this);\n }\n this._offset = input;\n this._isUTC = true;\n if (localAdjust != null) {\n this.add(localAdjust, 'm');\n }\n if (offset !== input) {\n if (!keepLocalTime || this._changeInProgress) {\n addSubtract(\n this,\n createDuration(input - offset, 'm'),\n 1,\n false\n );\n } else if (!this._changeInProgress) {\n this._changeInProgress = true;\n hooks.updateOffset(this, true);\n this._changeInProgress = null;\n }\n }\n return this;\n } else {\n return this._isUTC ? offset : getDateOffset(this);\n }\n }\n\n function getSetZone(input, keepLocalTime) {\n if (input != null) {\n if (typeof input !== 'string') {\n input = -input;\n }\n\n this.utcOffset(input, keepLocalTime);\n\n return this;\n } else {\n return -this.utcOffset();\n }\n }\n\n function setOffsetToUTC(keepLocalTime) {\n return this.utcOffset(0, keepLocalTime);\n }\n\n function setOffsetToLocal(keepLocalTime) {\n if (this._isUTC) {\n this.utcOffset(0, keepLocalTime);\n this._isUTC = false;\n\n if (keepLocalTime) {\n this.subtract(getDateOffset(this), 'm');\n }\n }\n return this;\n }\n\n function setOffsetToParsedOffset() {\n if (this._tzm != null) {\n this.utcOffset(this._tzm, false, true);\n } else if (typeof this._i === 'string') {\n var tZone = offsetFromString(matchOffset, this._i);\n if (tZone != null) {\n this.utcOffset(tZone);\n } else {\n this.utcOffset(0, true);\n }\n }\n return this;\n }\n\n function hasAlignedHourOffset(input) {\n if (!this.isValid()) {\n return false;\n }\n input = input ? createLocal(input).utcOffset() : 0;\n\n return (this.utcOffset() - input) % 60 === 0;\n }\n\n function isDaylightSavingTime() {\n return (\n this.utcOffset() > this.clone().month(0).utcOffset() ||\n this.utcOffset() > this.clone().month(5).utcOffset()\n );\n }\n\n function isDaylightSavingTimeShifted() {\n if (!isUndefined(this._isDSTShifted)) {\n return this._isDSTShifted;\n }\n\n var c = {},\n other;\n\n copyConfig(c, this);\n c = prepareConfig(c);\n\n if (c._a) {\n other = c._isUTC ? createUTC(c._a) : createLocal(c._a);\n this._isDSTShifted =\n this.isValid() && compareArrays(c._a, other.toArray()) > 0;\n } else {\n this._isDSTShifted = false;\n }\n\n return this._isDSTShifted;\n }\n\n function isLocal() {\n return this.isValid() ? !this._isUTC : false;\n }\n\n function isUtcOffset() {\n return this.isValid() ? this._isUTC : false;\n }\n\n function isUtc() {\n return this.isValid() ? this._isUTC && this._offset === 0 : false;\n }\n\n // ASP.NET json date format regex\n var aspNetRegex = /^(-|\\+)?(?:(\\d*)[. ])?(\\d+):(\\d+)(?::(\\d+)(\\.\\d*)?)?$/,\n // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html\n // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere\n // and further modified to allow for strings containing both week and day\n isoRegex =\n /^(-|\\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;\n\n function createDuration(input, key) {\n var duration = input,\n // matching against regexp is expensive, do it on demand\n match = null,\n sign,\n ret,\n diffRes;\n\n if (isDuration(input)) {\n duration = {\n ms: input._milliseconds,\n d: input._days,\n M: input._months,\n };\n } else if (isNumber(input) || !isNaN(+input)) {\n duration = {};\n if (key) {\n duration[key] = +input;\n } else {\n duration.milliseconds = +input;\n }\n } else if ((match = aspNetRegex.exec(input))) {\n sign = match[1] === '-' ? -1 : 1;\n duration = {\n y: 0,\n d: toInt(match[DATE]) * sign,\n h: toInt(match[HOUR]) * sign,\n m: toInt(match[MINUTE]) * sign,\n s: toInt(match[SECOND]) * sign,\n ms: toInt(absRound(match[MILLISECOND] * 1000)) * sign, // the millisecond decimal point is included in the match\n };\n } else if ((match = isoRegex.exec(input))) {\n sign = match[1] === '-' ? -1 : 1;\n duration = {\n y: parseIso(match[2], sign),\n M: parseIso(match[3], sign),\n w: parseIso(match[4], sign),\n d: parseIso(match[5], sign),\n h: parseIso(match[6], sign),\n m: parseIso(match[7], sign),\n s: parseIso(match[8], sign),\n };\n } else if (duration == null) {\n // checks for null or undefined\n duration = {};\n } else if (\n typeof duration === 'object' &&\n ('from' in duration || 'to' in duration)\n ) {\n diffRes = momentsDifference(\n createLocal(duration.from),\n createLocal(duration.to)\n );\n\n duration = {};\n duration.ms = diffRes.milliseconds;\n duration.M = diffRes.months;\n }\n\n ret = new Duration(duration);\n\n if (isDuration(input) && hasOwnProp(input, '_locale')) {\n ret._locale = input._locale;\n }\n\n if (isDuration(input) && hasOwnProp(input, '_isValid')) {\n ret._isValid = input._isValid;\n }\n\n return ret;\n }\n\n createDuration.fn = Duration.prototype;\n createDuration.invalid = createInvalid$1;\n\n function parseIso(inp, sign) {\n // We'd normally use ~~inp for this, but unfortunately it also\n // converts floats to ints.\n // inp may be undefined, so careful calling replace on it.\n var res = inp && parseFloat(inp.replace(',', '.'));\n // apply sign while we're at it\n return (isNaN(res) ? 0 : res) * sign;\n }\n\n function positiveMomentsDifference(base, other) {\n var res = {};\n\n res.months =\n other.month() - base.month() + (other.year() - base.year()) * 12;\n if (base.clone().add(res.months, 'M').isAfter(other)) {\n --res.months;\n }\n\n res.milliseconds = +other - +base.clone().add(res.months, 'M');\n\n return res;\n }\n\n function momentsDifference(base, other) {\n var res;\n if (!(base.isValid() && other.isValid())) {\n return { milliseconds: 0, months: 0 };\n }\n\n other = cloneWithOffset(other, base);\n if (base.isBefore(other)) {\n res = positiveMomentsDifference(base, other);\n } else {\n res = positiveMomentsDifference(other, base);\n res.milliseconds = -res.milliseconds;\n res.months = -res.months;\n }\n\n return res;\n }\n\n // TODO: remove 'name' arg after deprecation is removed\n function createAdder(direction, name) {\n return function (val, period) {\n var dur, tmp;\n //invert the arguments, but complain about it\n if (period !== null && !isNaN(+period)) {\n deprecateSimple(\n name,\n 'moment().' +\n name +\n '(period, number) is deprecated. Please use moment().' +\n name +\n '(number, period). ' +\n 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.'\n );\n tmp = val;\n val = period;\n period = tmp;\n }\n\n dur = createDuration(val, period);\n addSubtract(this, dur, direction);\n return this;\n };\n }\n\n function addSubtract(mom, duration, isAdding, updateOffset) {\n var milliseconds = duration._milliseconds,\n days = absRound(duration._days),\n months = absRound(duration._months);\n\n if (!mom.isValid()) {\n // No op\n return;\n }\n\n updateOffset = updateOffset == null ? true : updateOffset;\n\n if (months) {\n setMonth(mom, get(mom, 'Month') + months * isAdding);\n }\n if (days) {\n set$1(mom, 'Date', get(mom, 'Date') + days * isAdding);\n }\n if (milliseconds) {\n mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding);\n }\n if (updateOffset) {\n hooks.updateOffset(mom, days || months);\n }\n }\n\n var add = createAdder(1, 'add'),\n subtract = createAdder(-1, 'subtract');\n\n function isString(input) {\n return typeof input === 'string' || input instanceof String;\n }\n\n // type MomentInput = Moment | Date | string | number | (number | string)[] | MomentInputObject | void; // null | undefined\n function isMomentInput(input) {\n return (\n isMoment(input) ||\n isDate(input) ||\n isString(input) ||\n isNumber(input) ||\n isNumberOrStringArray(input) ||\n isMomentInputObject(input) ||\n input === null ||\n input === undefined\n );\n }\n\n function isMomentInputObject(input) {\n var objectTest = isObject(input) && !isObjectEmpty(input),\n propertyTest = false,\n properties = [\n 'years',\n 'year',\n 'y',\n 'months',\n 'month',\n 'M',\n 'days',\n 'day',\n 'd',\n 'dates',\n 'date',\n 'D',\n 'hours',\n 'hour',\n 'h',\n 'minutes',\n 'minute',\n 'm',\n 'seconds',\n 'second',\n 's',\n 'milliseconds',\n 'millisecond',\n 'ms',\n ],\n i,\n property,\n propertyLen = properties.length;\n\n for (i = 0; i < propertyLen; i += 1) {\n property = properties[i];\n propertyTest = propertyTest || hasOwnProp(input, property);\n }\n\n return objectTest && propertyTest;\n }\n\n function isNumberOrStringArray(input) {\n var arrayTest = isArray(input),\n dataTypeTest = false;\n if (arrayTest) {\n dataTypeTest =\n input.filter(function (item) {\n return !isNumber(item) && isString(input);\n }).length === 0;\n }\n return arrayTest && dataTypeTest;\n }\n\n function isCalendarSpec(input) {\n var objectTest = isObject(input) && !isObjectEmpty(input),\n propertyTest = false,\n properties = [\n 'sameDay',\n 'nextDay',\n 'lastDay',\n 'nextWeek',\n 'lastWeek',\n 'sameElse',\n ],\n i,\n property;\n\n for (i = 0; i < properties.length; i += 1) {\n property = properties[i];\n propertyTest = propertyTest || hasOwnProp(input, property);\n }\n\n return objectTest && propertyTest;\n }\n\n function getCalendarFormat(myMoment, now) {\n var diff = myMoment.diff(now, 'days', true);\n return diff < -6\n ? 'sameElse'\n : diff < -1\n ? 'lastWeek'\n : diff < 0\n ? 'lastDay'\n : diff < 1\n ? 'sameDay'\n : diff < 2\n ? 'nextDay'\n : diff < 7\n ? 'nextWeek'\n : 'sameElse';\n }\n\n function calendar$1(time, formats) {\n // Support for single parameter, formats only overload to the calendar function\n if (arguments.length === 1) {\n if (!arguments[0]) {\n time = undefined;\n formats = undefined;\n } else if (isMomentInput(arguments[0])) {\n time = arguments[0];\n formats = undefined;\n } else if (isCalendarSpec(arguments[0])) {\n formats = arguments[0];\n time = undefined;\n }\n }\n // We want to compare the start of today, vs this.\n // Getting start-of-today depends on whether we're local/utc/offset or not.\n var now = time || createLocal(),\n sod = cloneWithOffset(now, this).startOf('day'),\n format = hooks.calendarFormat(this, sod) || 'sameElse',\n output =\n formats &&\n (isFunction(formats[format])\n ? formats[format].call(this, now)\n : formats[format]);\n\n return this.format(\n output || this.localeData().calendar(format, this, createLocal(now))\n );\n }\n\n function clone() {\n return new Moment(this);\n }\n\n function isAfter(input, units) {\n var localInput = isMoment(input) ? input : createLocal(input);\n if (!(this.isValid() && localInput.isValid())) {\n return false;\n }\n units = normalizeUnits(units) || 'millisecond';\n if (units === 'millisecond') {\n return this.valueOf() > localInput.valueOf();\n } else {\n return localInput.valueOf() < this.clone().startOf(units).valueOf();\n }\n }\n\n function isBefore(input, units) {\n var localInput = isMoment(input) ? input : createLocal(input);\n if (!(this.isValid() && localInput.isValid())) {\n return false;\n }\n units = normalizeUnits(units) || 'millisecond';\n if (units === 'millisecond') {\n return this.valueOf() < localInput.valueOf();\n } else {\n return this.clone().endOf(units).valueOf() < localInput.valueOf();\n }\n }\n\n function isBetween(from, to, units, inclusivity) {\n var localFrom = isMoment(from) ? from : createLocal(from),\n localTo = isMoment(to) ? to : createLocal(to);\n if (!(this.isValid() && localFrom.isValid() && localTo.isValid())) {\n return false;\n }\n inclusivity = inclusivity || '()';\n return (\n (inclusivity[0] === '('\n ? this.isAfter(localFrom, units)\n : !this.isBefore(localFrom, units)) &&\n (inclusivity[1] === ')'\n ? this.isBefore(localTo, units)\n : !this.isAfter(localTo, units))\n );\n }\n\n function isSame(input, units) {\n var localInput = isMoment(input) ? input : createLocal(input),\n inputMs;\n if (!(this.isValid() && localInput.isValid())) {\n return false;\n }\n units = normalizeUnits(units) || 'millisecond';\n if (units === 'millisecond') {\n return this.valueOf() === localInput.valueOf();\n } else {\n inputMs = localInput.valueOf();\n return (\n this.clone().startOf(units).valueOf() <= inputMs &&\n inputMs <= this.clone().endOf(units).valueOf()\n );\n }\n }\n\n function isSameOrAfter(input, units) {\n return this.isSame(input, units) || this.isAfter(input, units);\n }\n\n function isSameOrBefore(input, units) {\n return this.isSame(input, units) || this.isBefore(input, units);\n }\n\n function diff(input, units, asFloat) {\n var that, zoneDelta, output;\n\n if (!this.isValid()) {\n return NaN;\n }\n\n that = cloneWithOffset(input, this);\n\n if (!that.isValid()) {\n return NaN;\n }\n\n zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4;\n\n units = normalizeUnits(units);\n\n switch (units) {\n case 'year':\n output = monthDiff(this, that) / 12;\n break;\n case 'month':\n output = monthDiff(this, that);\n break;\n case 'quarter':\n output = monthDiff(this, that) / 3;\n break;\n case 'second':\n output = (this - that) / 1e3;\n break; // 1000\n case 'minute':\n output = (this - that) / 6e4;\n break; // 1000 * 60\n case 'hour':\n output = (this - that) / 36e5;\n break; // 1000 * 60 * 60\n case 'day':\n output = (this - that - zoneDelta) / 864e5;\n break; // 1000 * 60 * 60 * 24, negate dst\n case 'week':\n output = (this - that - zoneDelta) / 6048e5;\n break; // 1000 * 60 * 60 * 24 * 7, negate dst\n default:\n output = this - that;\n }\n\n return asFloat ? output : absFloor(output);\n }\n\n function monthDiff(a, b) {\n if (a.date() < b.date()) {\n // end-of-month calculations work correct when the start month has more\n // days than the end month.\n return -monthDiff(b, a);\n }\n // difference in months\n var wholeMonthDiff = (b.year() - a.year()) * 12 + (b.month() - a.month()),\n // b is in (anchor - 1 month, anchor + 1 month)\n anchor = a.clone().add(wholeMonthDiff, 'months'),\n anchor2,\n adjust;\n\n if (b - anchor < 0) {\n anchor2 = a.clone().add(wholeMonthDiff - 1, 'months');\n // linear across the month\n adjust = (b - anchor) / (anchor - anchor2);\n } else {\n anchor2 = a.clone().add(wholeMonthDiff + 1, 'months');\n // linear across the month\n adjust = (b - anchor) / (anchor2 - anchor);\n }\n\n //check for negative zero, return zero if negative zero\n return -(wholeMonthDiff + adjust) || 0;\n }\n\n hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ';\n hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]';\n\n function toString() {\n return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ');\n }\n\n function toISOString(keepOffset) {\n if (!this.isValid()) {\n return null;\n }\n var utc = keepOffset !== true,\n m = utc ? this.clone().utc() : this;\n if (m.year() < 0 || m.year() > 9999) {\n return formatMoment(\n m,\n utc\n ? 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]'\n : 'YYYYYY-MM-DD[T]HH:mm:ss.SSSZ'\n );\n }\n if (isFunction(Date.prototype.toISOString)) {\n // native implementation is ~50x faster, use it when we can\n if (utc) {\n return this.toDate().toISOString();\n } else {\n return new Date(this.valueOf() + this.utcOffset() * 60 * 1000)\n .toISOString()\n .replace('Z', formatMoment(m, 'Z'));\n }\n }\n return formatMoment(\n m,\n utc ? 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYY-MM-DD[T]HH:mm:ss.SSSZ'\n );\n }\n\n /**\n * Return a human readable representation of a moment that can\n * also be evaluated to get a new moment which is the same\n *\n * @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects\n */\n function inspect() {\n if (!this.isValid()) {\n return 'moment.invalid(/* ' + this._i + ' */)';\n }\n var func = 'moment',\n zone = '',\n prefix,\n year,\n datetime,\n suffix;\n if (!this.isLocal()) {\n func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';\n zone = 'Z';\n }\n prefix = '[' + func + '(\"]';\n year = 0 <= this.year() && this.year() <= 9999 ? 'YYYY' : 'YYYYYY';\n datetime = '-MM-DD[T]HH:mm:ss.SSS';\n suffix = zone + '[\")]';\n\n return this.format(prefix + year + datetime + suffix);\n }\n\n function format(inputString) {\n if (!inputString) {\n inputString = this.isUtc()\n ? hooks.defaultFormatUtc\n : hooks.defaultFormat;\n }\n var output = formatMoment(this, inputString);\n return this.localeData().postformat(output);\n }\n\n function from(time, withoutSuffix) {\n if (\n this.isValid() &&\n ((isMoment(time) && time.isValid()) || createLocal(time).isValid())\n ) {\n return createDuration({ to: this, from: time })\n .locale(this.locale())\n .humanize(!withoutSuffix);\n } else {\n return this.localeData().invalidDate();\n }\n }\n\n function fromNow(withoutSuffix) {\n return this.from(createLocal(), withoutSuffix);\n }\n\n function to(time, withoutSuffix) {\n if (\n this.isValid() &&\n ((isMoment(time) && time.isValid()) || createLocal(time).isValid())\n ) {\n return createDuration({ from: this, to: time })\n .locale(this.locale())\n .humanize(!withoutSuffix);\n } else {\n return this.localeData().invalidDate();\n }\n }\n\n function toNow(withoutSuffix) {\n return this.to(createLocal(), withoutSuffix);\n }\n\n // If passed a locale key, it will set the locale for this\n // instance. Otherwise, it will return the locale configuration\n // variables for this instance.\n function locale(key) {\n var newLocaleData;\n\n if (key === undefined) {\n return this._locale._abbr;\n } else {\n newLocaleData = getLocale(key);\n if (newLocaleData != null) {\n this._locale = newLocaleData;\n }\n return this;\n }\n }\n\n var lang = deprecate(\n 'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.',\n function (key) {\n if (key === undefined) {\n return this.localeData();\n } else {\n return this.locale(key);\n }\n }\n );\n\n function localeData() {\n return this._locale;\n }\n\n var MS_PER_SECOND = 1000,\n MS_PER_MINUTE = 60 * MS_PER_SECOND,\n MS_PER_HOUR = 60 * MS_PER_MINUTE,\n MS_PER_400_YEARS = (365 * 400 + 97) * 24 * MS_PER_HOUR;\n\n // actual modulo - handles negative numbers (for dates before 1970):\n function mod$1(dividend, divisor) {\n return ((dividend % divisor) + divisor) % divisor;\n }\n\n function localStartOfDate(y, m, d) {\n // the date constructor remaps years 0-99 to 1900-1999\n if (y < 100 && y >= 0) {\n // preserve leap years using a full 400 year cycle, then reset\n return new Date(y + 400, m, d) - MS_PER_400_YEARS;\n } else {\n return new Date(y, m, d).valueOf();\n }\n }\n\n function utcStartOfDate(y, m, d) {\n // Date.UTC remaps years 0-99 to 1900-1999\n if (y < 100 && y >= 0) {\n // preserve leap years using a full 400 year cycle, then reset\n return Date.UTC(y + 400, m, d) - MS_PER_400_YEARS;\n } else {\n return Date.UTC(y, m, d);\n }\n }\n\n function startOf(units) {\n var time, startOfDate;\n units = normalizeUnits(units);\n if (units === undefined || units === 'millisecond' || !this.isValid()) {\n return this;\n }\n\n startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;\n\n switch (units) {\n case 'year':\n time = startOfDate(this.year(), 0, 1);\n break;\n case 'quarter':\n time = startOfDate(\n this.year(),\n this.month() - (this.month() % 3),\n 1\n );\n break;\n case 'month':\n time = startOfDate(this.year(), this.month(), 1);\n break;\n case 'week':\n time = startOfDate(\n this.year(),\n this.month(),\n this.date() - this.weekday()\n );\n break;\n case 'isoWeek':\n time = startOfDate(\n this.year(),\n this.month(),\n this.date() - (this.isoWeekday() - 1)\n );\n break;\n case 'day':\n case 'date':\n time = startOfDate(this.year(), this.month(), this.date());\n break;\n case 'hour':\n time = this._d.valueOf();\n time -= mod$1(\n time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE),\n MS_PER_HOUR\n );\n break;\n case 'minute':\n time = this._d.valueOf();\n time -= mod$1(time, MS_PER_MINUTE);\n break;\n case 'second':\n time = this._d.valueOf();\n time -= mod$1(time, MS_PER_SECOND);\n break;\n }\n\n this._d.setTime(time);\n hooks.updateOffset(this, true);\n return this;\n }\n\n function endOf(units) {\n var time, startOfDate;\n units = normalizeUnits(units);\n if (units === undefined || units === 'millisecond' || !this.isValid()) {\n return this;\n }\n\n startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;\n\n switch (units) {\n case 'year':\n time = startOfDate(this.year() + 1, 0, 1) - 1;\n break;\n case 'quarter':\n time =\n startOfDate(\n this.year(),\n this.month() - (this.month() % 3) + 3,\n 1\n ) - 1;\n break;\n case 'month':\n time = startOfDate(this.year(), this.month() + 1, 1) - 1;\n break;\n case 'week':\n time =\n startOfDate(\n this.year(),\n this.month(),\n this.date() - this.weekday() + 7\n ) - 1;\n break;\n case 'isoWeek':\n time =\n startOfDate(\n this.year(),\n this.month(),\n this.date() - (this.isoWeekday() - 1) + 7\n ) - 1;\n break;\n case 'day':\n case 'date':\n time = startOfDate(this.year(), this.month(), this.date() + 1) - 1;\n break;\n case 'hour':\n time = this._d.valueOf();\n time +=\n MS_PER_HOUR -\n mod$1(\n time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE),\n MS_PER_HOUR\n ) -\n 1;\n break;\n case 'minute':\n time = this._d.valueOf();\n time += MS_PER_MINUTE - mod$1(time, MS_PER_MINUTE) - 1;\n break;\n case 'second':\n time = this._d.valueOf();\n time += MS_PER_SECOND - mod$1(time, MS_PER_SECOND) - 1;\n break;\n }\n\n this._d.setTime(time);\n hooks.updateOffset(this, true);\n return this;\n }\n\n function valueOf() {\n return this._d.valueOf() - (this._offset || 0) * 60000;\n }\n\n function unix() {\n return Math.floor(this.valueOf() / 1000);\n }\n\n function toDate() {\n return new Date(this.valueOf());\n }\n\n function toArray() {\n var m = this;\n return [\n m.year(),\n m.month(),\n m.date(),\n m.hour(),\n m.minute(),\n m.second(),\n m.millisecond(),\n ];\n }\n\n function toObject() {\n var m = this;\n return {\n years: m.year(),\n months: m.month(),\n date: m.date(),\n hours: m.hours(),\n minutes: m.minutes(),\n seconds: m.seconds(),\n milliseconds: m.milliseconds(),\n };\n }\n\n function toJSON() {\n // new Date(NaN).toJSON() === null\n return this.isValid() ? this.toISOString() : null;\n }\n\n function isValid$2() {\n return isValid(this);\n }\n\n function parsingFlags() {\n return extend({}, getParsingFlags(this));\n }\n\n function invalidAt() {\n return getParsingFlags(this).overflow;\n }\n\n function creationData() {\n return {\n input: this._i,\n format: this._f,\n locale: this._locale,\n isUTC: this._isUTC,\n strict: this._strict,\n };\n }\n\n addFormatToken('N', 0, 0, 'eraAbbr');\n addFormatToken('NN', 0, 0, 'eraAbbr');\n addFormatToken('NNN', 0, 0, 'eraAbbr');\n addFormatToken('NNNN', 0, 0, 'eraName');\n addFormatToken('NNNNN', 0, 0, 'eraNarrow');\n\n addFormatToken('y', ['y', 1], 'yo', 'eraYear');\n addFormatToken('y', ['yy', 2], 0, 'eraYear');\n addFormatToken('y', ['yyy', 3], 0, 'eraYear');\n addFormatToken('y', ['yyyy', 4], 0, 'eraYear');\n\n addRegexToken('N', matchEraAbbr);\n addRegexToken('NN', matchEraAbbr);\n addRegexToken('NNN', matchEraAbbr);\n addRegexToken('NNNN', matchEraName);\n addRegexToken('NNNNN', matchEraNarrow);\n\n addParseToken(\n ['N', 'NN', 'NNN', 'NNNN', 'NNNNN'],\n function (input, array, config, token) {\n var era = config._locale.erasParse(input, token, config._strict);\n if (era) {\n getParsingFlags(config).era = era;\n } else {\n getParsingFlags(config).invalidEra = input;\n }\n }\n );\n\n addRegexToken('y', matchUnsigned);\n addRegexToken('yy', matchUnsigned);\n addRegexToken('yyy', matchUnsigned);\n addRegexToken('yyyy', matchUnsigned);\n addRegexToken('yo', matchEraYearOrdinal);\n\n addParseToken(['y', 'yy', 'yyy', 'yyyy'], YEAR);\n addParseToken(['yo'], function (input, array, config, token) {\n var match;\n if (config._locale._eraYearOrdinalRegex) {\n match = input.match(config._locale._eraYearOrdinalRegex);\n }\n\n if (config._locale.eraYearOrdinalParse) {\n array[YEAR] = config._locale.eraYearOrdinalParse(input, match);\n } else {\n array[YEAR] = parseInt(input, 10);\n }\n });\n\n function localeEras(m, format) {\n var i,\n l,\n date,\n eras = this._eras || getLocale('en')._eras;\n for (i = 0, l = eras.length; i < l; ++i) {\n switch (typeof eras[i].since) {\n case 'string':\n // truncate time\n date = hooks(eras[i].since).startOf('day');\n eras[i].since = date.valueOf();\n break;\n }\n\n switch (typeof eras[i].until) {\n case 'undefined':\n eras[i].until = +Infinity;\n break;\n case 'string':\n // truncate time\n date = hooks(eras[i].until).startOf('day').valueOf();\n eras[i].until = date.valueOf();\n break;\n }\n }\n return eras;\n }\n\n function localeErasParse(eraName, format, strict) {\n var i,\n l,\n eras = this.eras(),\n name,\n abbr,\n narrow;\n eraName = eraName.toUpperCase();\n\n for (i = 0, l = eras.length; i < l; ++i) {\n name = eras[i].name.toUpperCase();\n abbr = eras[i].abbr.toUpperCase();\n narrow = eras[i].narrow.toUpperCase();\n\n if (strict) {\n switch (format) {\n case 'N':\n case 'NN':\n case 'NNN':\n if (abbr === eraName) {\n return eras[i];\n }\n break;\n\n case 'NNNN':\n if (name === eraName) {\n return eras[i];\n }\n break;\n\n case 'NNNNN':\n if (narrow === eraName) {\n return eras[i];\n }\n break;\n }\n } else if ([name, abbr, narrow].indexOf(eraName) >= 0) {\n return eras[i];\n }\n }\n }\n\n function localeErasConvertYear(era, year) {\n var dir = era.since <= era.until ? +1 : -1;\n if (year === undefined) {\n return hooks(era.since).year();\n } else {\n return hooks(era.since).year() + (year - era.offset) * dir;\n }\n }\n\n function getEraName() {\n var i,\n l,\n val,\n eras = this.localeData().eras();\n for (i = 0, l = eras.length; i < l; ++i) {\n // truncate time\n val = this.clone().startOf('day').valueOf();\n\n if (eras[i].since <= val && val <= eras[i].until) {\n return eras[i].name;\n }\n if (eras[i].until <= val && val <= eras[i].since) {\n return eras[i].name;\n }\n }\n\n return '';\n }\n\n function getEraNarrow() {\n var i,\n l,\n val,\n eras = this.localeData().eras();\n for (i = 0, l = eras.length; i < l; ++i) {\n // truncate time\n val = this.clone().startOf('day').valueOf();\n\n if (eras[i].since <= val && val <= eras[i].until) {\n return eras[i].narrow;\n }\n if (eras[i].until <= val && val <= eras[i].since) {\n return eras[i].narrow;\n }\n }\n\n return '';\n }\n\n function getEraAbbr() {\n var i,\n l,\n val,\n eras = this.localeData().eras();\n for (i = 0, l = eras.length; i < l; ++i) {\n // truncate time\n val = this.clone().startOf('day').valueOf();\n\n if (eras[i].since <= val && val <= eras[i].until) {\n return eras[i].abbr;\n }\n if (eras[i].until <= val && val <= eras[i].since) {\n return eras[i].abbr;\n }\n }\n\n return '';\n }\n\n function getEraYear() {\n var i,\n l,\n dir,\n val,\n eras = this.localeData().eras();\n for (i = 0, l = eras.length; i < l; ++i) {\n dir = eras[i].since <= eras[i].until ? +1 : -1;\n\n // truncate time\n val = this.clone().startOf('day').valueOf();\n\n if (\n (eras[i].since <= val && val <= eras[i].until) ||\n (eras[i].until <= val && val <= eras[i].since)\n ) {\n return (\n (this.year() - hooks(eras[i].since).year()) * dir +\n eras[i].offset\n );\n }\n }\n\n return this.year();\n }\n\n function erasNameRegex(isStrict) {\n if (!hasOwnProp(this, '_erasNameRegex')) {\n computeErasParse.call(this);\n }\n return isStrict ? this._erasNameRegex : this._erasRegex;\n }\n\n function erasAbbrRegex(isStrict) {\n if (!hasOwnProp(this, '_erasAbbrRegex')) {\n computeErasParse.call(this);\n }\n return isStrict ? this._erasAbbrRegex : this._erasRegex;\n }\n\n function erasNarrowRegex(isStrict) {\n if (!hasOwnProp(this, '_erasNarrowRegex')) {\n computeErasParse.call(this);\n }\n return isStrict ? this._erasNarrowRegex : this._erasRegex;\n }\n\n function matchEraAbbr(isStrict, locale) {\n return locale.erasAbbrRegex(isStrict);\n }\n\n function matchEraName(isStrict, locale) {\n return locale.erasNameRegex(isStrict);\n }\n\n function matchEraNarrow(isStrict, locale) {\n return locale.erasNarrowRegex(isStrict);\n }\n\n function matchEraYearOrdinal(isStrict, locale) {\n return locale._eraYearOrdinalRegex || matchUnsigned;\n }\n\n function computeErasParse() {\n var abbrPieces = [],\n namePieces = [],\n narrowPieces = [],\n mixedPieces = [],\n i,\n l,\n erasName,\n erasAbbr,\n erasNarrow,\n eras = this.eras();\n\n for (i = 0, l = eras.length; i < l; ++i) {\n erasName = regexEscape(eras[i].name);\n erasAbbr = regexEscape(eras[i].abbr);\n erasNarrow = regexEscape(eras[i].narrow);\n\n namePieces.push(erasName);\n abbrPieces.push(erasAbbr);\n narrowPieces.push(erasNarrow);\n mixedPieces.push(erasName);\n mixedPieces.push(erasAbbr);\n mixedPieces.push(erasNarrow);\n }\n\n this._erasRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');\n this._erasNameRegex = new RegExp('^(' + namePieces.join('|') + ')', 'i');\n this._erasAbbrRegex = new RegExp('^(' + abbrPieces.join('|') + ')', 'i');\n this._erasNarrowRegex = new RegExp(\n '^(' + narrowPieces.join('|') + ')',\n 'i'\n );\n }\n\n // FORMATTING\n\n addFormatToken(0, ['gg', 2], 0, function () {\n return this.weekYear() % 100;\n });\n\n addFormatToken(0, ['GG', 2], 0, function () {\n return this.isoWeekYear() % 100;\n });\n\n function addWeekYearFormatToken(token, getter) {\n addFormatToken(0, [token, token.length], 0, getter);\n }\n\n addWeekYearFormatToken('gggg', 'weekYear');\n addWeekYearFormatToken('ggggg', 'weekYear');\n addWeekYearFormatToken('GGGG', 'isoWeekYear');\n addWeekYearFormatToken('GGGGG', 'isoWeekYear');\n\n // ALIASES\n\n // PARSING\n\n addRegexToken('G', matchSigned);\n addRegexToken('g', matchSigned);\n addRegexToken('GG', match1to2, match2);\n addRegexToken('gg', match1to2, match2);\n addRegexToken('GGGG', match1to4, match4);\n addRegexToken('gggg', match1to4, match4);\n addRegexToken('GGGGG', match1to6, match6);\n addRegexToken('ggggg', match1to6, match6);\n\n addWeekParseToken(\n ['gggg', 'ggggg', 'GGGG', 'GGGGG'],\n function (input, week, config, token) {\n week[token.substr(0, 2)] = toInt(input);\n }\n );\n\n addWeekParseToken(['gg', 'GG'], function (input, week, config, token) {\n week[token] = hooks.parseTwoDigitYear(input);\n });\n\n // MOMENTS\n\n function getSetWeekYear(input) {\n return getSetWeekYearHelper.call(\n this,\n input,\n this.week(),\n this.weekday() + this.localeData()._week.dow,\n this.localeData()._week.dow,\n this.localeData()._week.doy\n );\n }\n\n function getSetISOWeekYear(input) {\n return getSetWeekYearHelper.call(\n this,\n input,\n this.isoWeek(),\n this.isoWeekday(),\n 1,\n 4\n );\n }\n\n function getISOWeeksInYear() {\n return weeksInYear(this.year(), 1, 4);\n }\n\n function getISOWeeksInISOWeekYear() {\n return weeksInYear(this.isoWeekYear(), 1, 4);\n }\n\n function getWeeksInYear() {\n var weekInfo = this.localeData()._week;\n return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);\n }\n\n function getWeeksInWeekYear() {\n var weekInfo = this.localeData()._week;\n return weeksInYear(this.weekYear(), weekInfo.dow, weekInfo.doy);\n }\n\n function getSetWeekYearHelper(input, week, weekday, dow, doy) {\n var weeksTarget;\n if (input == null) {\n return weekOfYear(this, dow, doy).year;\n } else {\n weeksTarget = weeksInYear(input, dow, doy);\n if (week > weeksTarget) {\n week = weeksTarget;\n }\n return setWeekAll.call(this, input, week, weekday, dow, doy);\n }\n }\n\n function setWeekAll(weekYear, week, weekday, dow, doy) {\n var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy),\n date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear);\n\n this.year(date.getUTCFullYear());\n this.month(date.getUTCMonth());\n this.date(date.getUTCDate());\n return this;\n }\n\n // FORMATTING\n\n addFormatToken('Q', 0, 'Qo', 'quarter');\n\n // PARSING\n\n addRegexToken('Q', match1);\n addParseToken('Q', function (input, array) {\n array[MONTH] = (toInt(input) - 1) * 3;\n });\n\n // MOMENTS\n\n function getSetQuarter(input) {\n return input == null\n ? Math.ceil((this.month() + 1) / 3)\n : this.month((input - 1) * 3 + (this.month() % 3));\n }\n\n // FORMATTING\n\n addFormatToken('D', ['DD', 2], 'Do', 'date');\n\n // PARSING\n\n addRegexToken('D', match1to2, match1to2NoLeadingZero);\n addRegexToken('DD', match1to2, match2);\n addRegexToken('Do', function (isStrict, locale) {\n // TODO: Remove \"ordinalParse\" fallback in next major release.\n return isStrict\n ? locale._dayOfMonthOrdinalParse || locale._ordinalParse\n : locale._dayOfMonthOrdinalParseLenient;\n });\n\n addParseToken(['D', 'DD'], DATE);\n addParseToken('Do', function (input, array) {\n array[DATE] = toInt(input.match(match1to2)[0]);\n });\n\n // MOMENTS\n\n var getSetDayOfMonth = makeGetSet('Date', true);\n\n // FORMATTING\n\n addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear');\n\n // PARSING\n\n addRegexToken('DDD', match1to3);\n addRegexToken('DDDD', match3);\n addParseToken(['DDD', 'DDDD'], function (input, array, config) {\n config._dayOfYear = toInt(input);\n });\n\n // HELPERS\n\n // MOMENTS\n\n function getSetDayOfYear(input) {\n var dayOfYear =\n Math.round(\n (this.clone().startOf('day') - this.clone().startOf('year')) / 864e5\n ) + 1;\n return input == null ? dayOfYear : this.add(input - dayOfYear, 'd');\n }\n\n // FORMATTING\n\n addFormatToken('m', ['mm', 2], 0, 'minute');\n\n // PARSING\n\n addRegexToken('m', match1to2, match1to2HasZero);\n addRegexToken('mm', match1to2, match2);\n addParseToken(['m', 'mm'], MINUTE);\n\n // MOMENTS\n\n var getSetMinute = makeGetSet('Minutes', false);\n\n // FORMATTING\n\n addFormatToken('s', ['ss', 2], 0, 'second');\n\n // PARSING\n\n addRegexToken('s', match1to2, match1to2HasZero);\n addRegexToken('ss', match1to2, match2);\n addParseToken(['s', 'ss'], SECOND);\n\n // MOMENTS\n\n var getSetSecond = makeGetSet('Seconds', false);\n\n // FORMATTING\n\n addFormatToken('S', 0, 0, function () {\n return ~~(this.millisecond() / 100);\n });\n\n addFormatToken(0, ['SS', 2], 0, function () {\n return ~~(this.millisecond() / 10);\n });\n\n addFormatToken(0, ['SSS', 3], 0, 'millisecond');\n addFormatToken(0, ['SSSS', 4], 0, function () {\n return this.millisecond() * 10;\n });\n addFormatToken(0, ['SSSSS', 5], 0, function () {\n return this.millisecond() * 100;\n });\n addFormatToken(0, ['SSSSSS', 6], 0, function () {\n return this.millisecond() * 1000;\n });\n addFormatToken(0, ['SSSSSSS', 7], 0, function () {\n return this.millisecond() * 10000;\n });\n addFormatToken(0, ['SSSSSSSS', 8], 0, function () {\n return this.millisecond() * 100000;\n });\n addFormatToken(0, ['SSSSSSSSS', 9], 0, function () {\n return this.millisecond() * 1000000;\n });\n\n // PARSING\n\n addRegexToken('S', match1to3, match1);\n addRegexToken('SS', match1to3, match2);\n addRegexToken('SSS', match1to3, match3);\n\n var token, getSetMillisecond;\n for (token = 'SSSS'; token.length <= 9; token += 'S') {\n addRegexToken(token, matchUnsigned);\n }\n\n function parseMs(input, array) {\n array[MILLISECOND] = toInt(('0.' + input) * 1000);\n }\n\n for (token = 'S'; token.length <= 9; token += 'S') {\n addParseToken(token, parseMs);\n }\n\n getSetMillisecond = makeGetSet('Milliseconds', false);\n\n // FORMATTING\n\n addFormatToken('z', 0, 0, 'zoneAbbr');\n addFormatToken('zz', 0, 0, 'zoneName');\n\n // MOMENTS\n\n function getZoneAbbr() {\n return this._isUTC ? 'UTC' : '';\n }\n\n function getZoneName() {\n return this._isUTC ? 'Coordinated Universal Time' : '';\n }\n\n var proto = Moment.prototype;\n\n proto.add = add;\n proto.calendar = calendar$1;\n proto.clone = clone;\n proto.diff = diff;\n proto.endOf = endOf;\n proto.format = format;\n proto.from = from;\n proto.fromNow = fromNow;\n proto.to = to;\n proto.toNow = toNow;\n proto.get = stringGet;\n proto.invalidAt = invalidAt;\n proto.isAfter = isAfter;\n proto.isBefore = isBefore;\n proto.isBetween = isBetween;\n proto.isSame = isSame;\n proto.isSameOrAfter = isSameOrAfter;\n proto.isSameOrBefore = isSameOrBefore;\n proto.isValid = isValid$2;\n proto.lang = lang;\n proto.locale = locale;\n proto.localeData = localeData;\n proto.max = prototypeMax;\n proto.min = prototypeMin;\n proto.parsingFlags = parsingFlags;\n proto.set = stringSet;\n proto.startOf = startOf;\n proto.subtract = subtract;\n proto.toArray = toArray;\n proto.toObject = toObject;\n proto.toDate = toDate;\n proto.toISOString = toISOString;\n proto.inspect = inspect;\n if (typeof Symbol !== 'undefined' && Symbol.for != null) {\n proto[Symbol.for('nodejs.util.inspect.custom')] = function () {\n return 'Moment<' + this.format() + '>';\n };\n }\n proto.toJSON = toJSON;\n proto.toString = toString;\n proto.unix = unix;\n proto.valueOf = valueOf;\n proto.creationData = creationData;\n proto.eraName = getEraName;\n proto.eraNarrow = getEraNarrow;\n proto.eraAbbr = getEraAbbr;\n proto.eraYear = getEraYear;\n proto.year = getSetYear;\n proto.isLeapYear = getIsLeapYear;\n proto.weekYear = getSetWeekYear;\n proto.isoWeekYear = getSetISOWeekYear;\n proto.quarter = proto.quarters = getSetQuarter;\n proto.month = getSetMonth;\n proto.daysInMonth = getDaysInMonth;\n proto.week = proto.weeks = getSetWeek;\n proto.isoWeek = proto.isoWeeks = getSetISOWeek;\n proto.weeksInYear = getWeeksInYear;\n proto.weeksInWeekYear = getWeeksInWeekYear;\n proto.isoWeeksInYear = getISOWeeksInYear;\n proto.isoWeeksInISOWeekYear = getISOWeeksInISOWeekYear;\n proto.date = getSetDayOfMonth;\n proto.day = proto.days = getSetDayOfWeek;\n proto.weekday = getSetLocaleDayOfWeek;\n proto.isoWeekday = getSetISODayOfWeek;\n proto.dayOfYear = getSetDayOfYear;\n proto.hour = proto.hours = getSetHour;\n proto.minute = proto.minutes = getSetMinute;\n proto.second = proto.seconds = getSetSecond;\n proto.millisecond = proto.milliseconds = getSetMillisecond;\n proto.utcOffset = getSetOffset;\n proto.utc = setOffsetToUTC;\n proto.local = setOffsetToLocal;\n proto.parseZone = setOffsetToParsedOffset;\n proto.hasAlignedHourOffset = hasAlignedHourOffset;\n proto.isDST = isDaylightSavingTime;\n proto.isLocal = isLocal;\n proto.isUtcOffset = isUtcOffset;\n proto.isUtc = isUtc;\n proto.isUTC = isUtc;\n proto.zoneAbbr = getZoneAbbr;\n proto.zoneName = getZoneName;\n proto.dates = deprecate(\n 'dates accessor is deprecated. Use date instead.',\n getSetDayOfMonth\n );\n proto.months = deprecate(\n 'months accessor is deprecated. Use month instead',\n getSetMonth\n );\n proto.years = deprecate(\n 'years accessor is deprecated. Use year instead',\n getSetYear\n );\n proto.zone = deprecate(\n 'moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/',\n getSetZone\n );\n proto.isDSTShifted = deprecate(\n 'isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information',\n isDaylightSavingTimeShifted\n );\n\n function createUnix(input) {\n return createLocal(input * 1000);\n }\n\n function createInZone() {\n return createLocal.apply(null, arguments).parseZone();\n }\n\n function preParsePostFormat(string) {\n return string;\n }\n\n var proto$1 = Locale.prototype;\n\n proto$1.calendar = calendar;\n proto$1.longDateFormat = longDateFormat;\n proto$1.invalidDate = invalidDate;\n proto$1.ordinal = ordinal;\n proto$1.preparse = preParsePostFormat;\n proto$1.postformat = preParsePostFormat;\n proto$1.relativeTime = relativeTime;\n proto$1.pastFuture = pastFuture;\n proto$1.set = set;\n proto$1.eras = localeEras;\n proto$1.erasParse = localeErasParse;\n proto$1.erasConvertYear = localeErasConvertYear;\n proto$1.erasAbbrRegex = erasAbbrRegex;\n proto$1.erasNameRegex = erasNameRegex;\n proto$1.erasNarrowRegex = erasNarrowRegex;\n\n proto$1.months = localeMonths;\n proto$1.monthsShort = localeMonthsShort;\n proto$1.monthsParse = localeMonthsParse;\n proto$1.monthsRegex = monthsRegex;\n proto$1.monthsShortRegex = monthsShortRegex;\n proto$1.week = localeWeek;\n proto$1.firstDayOfYear = localeFirstDayOfYear;\n proto$1.firstDayOfWeek = localeFirstDayOfWeek;\n\n proto$1.weekdays = localeWeekdays;\n proto$1.weekdaysMin = localeWeekdaysMin;\n proto$1.weekdaysShort = localeWeekdaysShort;\n proto$1.weekdaysParse = localeWeekdaysParse;\n\n proto$1.weekdaysRegex = weekdaysRegex;\n proto$1.weekdaysShortRegex = weekdaysShortRegex;\n proto$1.weekdaysMinRegex = weekdaysMinRegex;\n\n proto$1.isPM = localeIsPM;\n proto$1.meridiem = localeMeridiem;\n\n function get$1(format, index, field, setter) {\n var locale = getLocale(),\n utc = createUTC().set(setter, index);\n return locale[field](utc, format);\n }\n\n function listMonthsImpl(format, index, field) {\n if (isNumber(format)) {\n index = format;\n format = undefined;\n }\n\n format = format || '';\n\n if (index != null) {\n return get$1(format, index, field, 'month');\n }\n\n var i,\n out = [];\n for (i = 0; i < 12; i++) {\n out[i] = get$1(format, i, field, 'month');\n }\n return out;\n }\n\n // ()\n // (5)\n // (fmt, 5)\n // (fmt)\n // (true)\n // (true, 5)\n // (true, fmt, 5)\n // (true, fmt)\n function listWeekdaysImpl(localeSorted, format, index, field) {\n if (typeof localeSorted === 'boolean') {\n if (isNumber(format)) {\n index = format;\n format = undefined;\n }\n\n format = format || '';\n } else {\n format = localeSorted;\n index = format;\n localeSorted = false;\n\n if (isNumber(format)) {\n index = format;\n format = undefined;\n }\n\n format = format || '';\n }\n\n var locale = getLocale(),\n shift = localeSorted ? locale._week.dow : 0,\n i,\n out = [];\n\n if (index != null) {\n return get$1(format, (index + shift) % 7, field, 'day');\n }\n\n for (i = 0; i < 7; i++) {\n out[i] = get$1(format, (i + shift) % 7, field, 'day');\n }\n return out;\n }\n\n function listMonths(format, index) {\n return listMonthsImpl(format, index, 'months');\n }\n\n function listMonthsShort(format, index) {\n return listMonthsImpl(format, index, 'monthsShort');\n }\n\n function listWeekdays(localeSorted, format, index) {\n return listWeekdaysImpl(localeSorted, format, index, 'weekdays');\n }\n\n function listWeekdaysShort(localeSorted, format, index) {\n return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort');\n }\n\n function listWeekdaysMin(localeSorted, format, index) {\n return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin');\n }\n\n getSetGlobalLocale('en', {\n eras: [\n {\n since: '0001-01-01',\n until: +Infinity,\n offset: 1,\n name: 'Anno Domini',\n narrow: 'AD',\n abbr: 'AD',\n },\n {\n since: '0000-12-31',\n until: -Infinity,\n offset: 1,\n name: 'Before Christ',\n narrow: 'BC',\n abbr: 'BC',\n },\n ],\n dayOfMonthOrdinalParse: /\\d{1,2}(th|st|nd|rd)/,\n ordinal: function (number) {\n var b = number % 10,\n output =\n toInt((number % 100) / 10) === 1\n ? 'th'\n : b === 1\n ? 'st'\n : b === 2\n ? 'nd'\n : b === 3\n ? 'rd'\n : 'th';\n return number + output;\n },\n });\n\n // Side effect imports\n\n hooks.lang = deprecate(\n 'moment.lang is deprecated. Use moment.locale instead.',\n getSetGlobalLocale\n );\n hooks.langData = deprecate(\n 'moment.langData is deprecated. Use moment.localeData instead.',\n getLocale\n );\n\n var mathAbs = Math.abs;\n\n function abs() {\n var data = this._data;\n\n this._milliseconds = mathAbs(this._milliseconds);\n this._days = mathAbs(this._days);\n this._months = mathAbs(this._months);\n\n data.milliseconds = mathAbs(data.milliseconds);\n data.seconds = mathAbs(data.seconds);\n data.minutes = mathAbs(data.minutes);\n data.hours = mathAbs(data.hours);\n data.months = mathAbs(data.months);\n data.years = mathAbs(data.years);\n\n return this;\n }\n\n function addSubtract$1(duration, input, value, direction) {\n var other = createDuration(input, value);\n\n duration._milliseconds += direction * other._milliseconds;\n duration._days += direction * other._days;\n duration._months += direction * other._months;\n\n return duration._bubble();\n }\n\n // supports only 2.0-style add(1, 's') or add(duration)\n function add$1(input, value) {\n return addSubtract$1(this, input, value, 1);\n }\n\n // supports only 2.0-style subtract(1, 's') or subtract(duration)\n function subtract$1(input, value) {\n return addSubtract$1(this, input, value, -1);\n }\n\n function absCeil(number) {\n if (number < 0) {\n return Math.floor(number);\n } else {\n return Math.ceil(number);\n }\n }\n\n function bubble() {\n var milliseconds = this._milliseconds,\n days = this._days,\n months = this._months,\n data = this._data,\n seconds,\n minutes,\n hours,\n years,\n monthsFromDays;\n\n // if we have a mix of positive and negative values, bubble down first\n // check: https://github.com/moment/moment/issues/2166\n if (\n !(\n (milliseconds >= 0 && days >= 0 && months >= 0) ||\n (milliseconds <= 0 && days <= 0 && months <= 0)\n )\n ) {\n milliseconds += absCeil(monthsToDays(months) + days) * 864e5;\n days = 0;\n months = 0;\n }\n\n // The following code bubbles up values, see the tests for\n // examples of what that means.\n data.milliseconds = milliseconds % 1000;\n\n seconds = absFloor(milliseconds / 1000);\n data.seconds = seconds % 60;\n\n minutes = absFloor(seconds / 60);\n data.minutes = minutes % 60;\n\n hours = absFloor(minutes / 60);\n data.hours = hours % 24;\n\n days += absFloor(hours / 24);\n\n // convert days to months\n monthsFromDays = absFloor(daysToMonths(days));\n months += monthsFromDays;\n days -= absCeil(monthsToDays(monthsFromDays));\n\n // 12 months -> 1 year\n years = absFloor(months / 12);\n months %= 12;\n\n data.days = days;\n data.months = months;\n data.years = years;\n\n return this;\n }\n\n function daysToMonths(days) {\n // 400 years have 146097 days (taking into account leap year rules)\n // 400 years have 12 months === 4800\n return (days * 4800) / 146097;\n }\n\n function monthsToDays(months) {\n // the reverse of daysToMonths\n return (months * 146097) / 4800;\n }\n\n function as(units) {\n if (!this.isValid()) {\n return NaN;\n }\n var days,\n months,\n milliseconds = this._milliseconds;\n\n units = normalizeUnits(units);\n\n if (units === 'month' || units === 'quarter' || units === 'year') {\n days = this._days + milliseconds / 864e5;\n months = this._months + daysToMonths(days);\n switch (units) {\n case 'month':\n return months;\n case 'quarter':\n return months / 3;\n case 'year':\n return months / 12;\n }\n } else {\n // handle milliseconds separately because of floating point math errors (issue #1867)\n days = this._days + Math.round(monthsToDays(this._months));\n switch (units) {\n case 'week':\n return days / 7 + milliseconds / 6048e5;\n case 'day':\n return days + milliseconds / 864e5;\n case 'hour':\n return days * 24 + milliseconds / 36e5;\n case 'minute':\n return days * 1440 + milliseconds / 6e4;\n case 'second':\n return days * 86400 + milliseconds / 1000;\n // Math.floor prevents floating point math errors here\n case 'millisecond':\n return Math.floor(days * 864e5) + milliseconds;\n default:\n throw new Error('Unknown unit ' + units);\n }\n }\n }\n\n function makeAs(alias) {\n return function () {\n return this.as(alias);\n };\n }\n\n var asMilliseconds = makeAs('ms'),\n asSeconds = makeAs('s'),\n asMinutes = makeAs('m'),\n asHours = makeAs('h'),\n asDays = makeAs('d'),\n asWeeks = makeAs('w'),\n asMonths = makeAs('M'),\n asQuarters = makeAs('Q'),\n asYears = makeAs('y'),\n valueOf$1 = asMilliseconds;\n\n function clone$1() {\n return createDuration(this);\n }\n\n function get$2(units) {\n units = normalizeUnits(units);\n return this.isValid() ? this[units + 's']() : NaN;\n }\n\n function makeGetter(name) {\n return function () {\n return this.isValid() ? this._data[name] : NaN;\n };\n }\n\n var milliseconds = makeGetter('milliseconds'),\n seconds = makeGetter('seconds'),\n minutes = makeGetter('minutes'),\n hours = makeGetter('hours'),\n days = makeGetter('days'),\n months = makeGetter('months'),\n years = makeGetter('years');\n\n function weeks() {\n return absFloor(this.days() / 7);\n }\n\n var round = Math.round,\n thresholds = {\n ss: 44, // a few seconds to seconds\n s: 45, // seconds to minute\n m: 45, // minutes to hour\n h: 22, // hours to day\n d: 26, // days to month/week\n w: null, // weeks to month\n M: 11, // months to year\n };\n\n // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize\n function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) {\n return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture);\n }\n\n function relativeTime$1(posNegDuration, withoutSuffix, thresholds, locale) {\n var duration = createDuration(posNegDuration).abs(),\n seconds = round(duration.as('s')),\n minutes = round(duration.as('m')),\n hours = round(duration.as('h')),\n days = round(duration.as('d')),\n months = round(duration.as('M')),\n weeks = round(duration.as('w')),\n years = round(duration.as('y')),\n a =\n (seconds <= thresholds.ss && ['s', seconds]) ||\n (seconds < thresholds.s && ['ss', seconds]) ||\n (minutes <= 1 && ['m']) ||\n (minutes < thresholds.m && ['mm', minutes]) ||\n (hours <= 1 && ['h']) ||\n (hours < thresholds.h && ['hh', hours]) ||\n (days <= 1 && ['d']) ||\n (days < thresholds.d && ['dd', days]);\n\n if (thresholds.w != null) {\n a =\n a ||\n (weeks <= 1 && ['w']) ||\n (weeks < thresholds.w && ['ww', weeks]);\n }\n a = a ||\n (months <= 1 && ['M']) ||\n (months < thresholds.M && ['MM', months]) ||\n (years <= 1 && ['y']) || ['yy', years];\n\n a[2] = withoutSuffix;\n a[3] = +posNegDuration > 0;\n a[4] = locale;\n return substituteTimeAgo.apply(null, a);\n }\n\n // This function allows you to set the rounding function for relative time strings\n function getSetRelativeTimeRounding(roundingFunction) {\n if (roundingFunction === undefined) {\n return round;\n }\n if (typeof roundingFunction === 'function') {\n round = roundingFunction;\n return true;\n }\n return false;\n }\n\n // This function allows you to set a threshold for relative time strings\n function getSetRelativeTimeThreshold(threshold, limit) {\n if (thresholds[threshold] === undefined) {\n return false;\n }\n if (limit === undefined) {\n return thresholds[threshold];\n }\n thresholds[threshold] = limit;\n if (threshold === 's') {\n thresholds.ss = limit - 1;\n }\n return true;\n }\n\n function humanize(argWithSuffix, argThresholds) {\n if (!this.isValid()) {\n return this.localeData().invalidDate();\n }\n\n var withSuffix = false,\n th = thresholds,\n locale,\n output;\n\n if (typeof argWithSuffix === 'object') {\n argThresholds = argWithSuffix;\n argWithSuffix = false;\n }\n if (typeof argWithSuffix === 'boolean') {\n withSuffix = argWithSuffix;\n }\n if (typeof argThresholds === 'object') {\n th = Object.assign({}, thresholds, argThresholds);\n if (argThresholds.s != null && argThresholds.ss == null) {\n th.ss = argThresholds.s - 1;\n }\n }\n\n locale = this.localeData();\n output = relativeTime$1(this, !withSuffix, th, locale);\n\n if (withSuffix) {\n output = locale.pastFuture(+this, output);\n }\n\n return locale.postformat(output);\n }\n\n var abs$1 = Math.abs;\n\n function sign(x) {\n return (x > 0) - (x < 0) || +x;\n }\n\n function toISOString$1() {\n // for ISO strings we do not use the normal bubbling rules:\n // * milliseconds bubble up until they become hours\n // * days do not bubble at all\n // * months bubble up until they become years\n // This is because there is no context-free conversion between hours and days\n // (think of clock changes)\n // and also not between days and months (28-31 days per month)\n if (!this.isValid()) {\n return this.localeData().invalidDate();\n }\n\n var seconds = abs$1(this._milliseconds) / 1000,\n days = abs$1(this._days),\n months = abs$1(this._months),\n minutes,\n hours,\n years,\n s,\n total = this.asSeconds(),\n totalSign,\n ymSign,\n daysSign,\n hmsSign;\n\n if (!total) {\n // this is the same as C#'s (Noda) and python (isodate)...\n // but not other JS (goog.date)\n return 'P0D';\n }\n\n // 3600 seconds -> 60 minutes -> 1 hour\n minutes = absFloor(seconds / 60);\n hours = absFloor(minutes / 60);\n seconds %= 60;\n minutes %= 60;\n\n // 12 months -> 1 year\n years = absFloor(months / 12);\n months %= 12;\n\n // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js\n s = seconds ? seconds.toFixed(3).replace(/\\.?0+$/, '') : '';\n\n totalSign = total < 0 ? '-' : '';\n ymSign = sign(this._months) !== sign(total) ? '-' : '';\n daysSign = sign(this._days) !== sign(total) ? '-' : '';\n hmsSign = sign(this._milliseconds) !== sign(total) ? '-' : '';\n\n return (\n totalSign +\n 'P' +\n (years ? ymSign + years + 'Y' : '') +\n (months ? ymSign + months + 'M' : '') +\n (days ? daysSign + days + 'D' : '') +\n (hours || minutes || seconds ? 'T' : '') +\n (hours ? hmsSign + hours + 'H' : '') +\n (minutes ? hmsSign + minutes + 'M' : '') +\n (seconds ? hmsSign + s + 'S' : '')\n );\n }\n\n var proto$2 = Duration.prototype;\n\n proto$2.isValid = isValid$1;\n proto$2.abs = abs;\n proto$2.add = add$1;\n proto$2.subtract = subtract$1;\n proto$2.as = as;\n proto$2.asMilliseconds = asMilliseconds;\n proto$2.asSeconds = asSeconds;\n proto$2.asMinutes = asMinutes;\n proto$2.asHours = asHours;\n proto$2.asDays = asDays;\n proto$2.asWeeks = asWeeks;\n proto$2.asMonths = asMonths;\n proto$2.asQuarters = asQuarters;\n proto$2.asYears = asYears;\n proto$2.valueOf = valueOf$1;\n proto$2._bubble = bubble;\n proto$2.clone = clone$1;\n proto$2.get = get$2;\n proto$2.milliseconds = milliseconds;\n proto$2.seconds = seconds;\n proto$2.minutes = minutes;\n proto$2.hours = hours;\n proto$2.days = days;\n proto$2.weeks = weeks;\n proto$2.months = months;\n proto$2.years = years;\n proto$2.humanize = humanize;\n proto$2.toISOString = toISOString$1;\n proto$2.toString = toISOString$1;\n proto$2.toJSON = toISOString$1;\n proto$2.locale = locale;\n proto$2.localeData = localeData;\n\n proto$2.toIsoString = deprecate(\n 'toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)',\n toISOString$1\n );\n proto$2.lang = lang;\n\n // FORMATTING\n\n addFormatToken('X', 0, 0, 'unix');\n addFormatToken('x', 0, 0, 'valueOf');\n\n // PARSING\n\n addRegexToken('x', matchSigned);\n addRegexToken('X', matchTimestamp);\n addParseToken('X', function (input, array, config) {\n config._d = new Date(parseFloat(input) * 1000);\n });\n addParseToken('x', function (input, array, config) {\n config._d = new Date(toInt(input));\n });\n\n //! moment.js\n\n hooks.version = '2.30.1';\n\n setHookCallback(createLocal);\n\n hooks.fn = proto;\n hooks.min = min;\n hooks.max = max;\n hooks.now = now;\n hooks.utc = createUTC;\n hooks.unix = createUnix;\n hooks.months = listMonths;\n hooks.isDate = isDate;\n hooks.locale = getSetGlobalLocale;\n hooks.invalid = createInvalid;\n hooks.duration = createDuration;\n hooks.isMoment = isMoment;\n hooks.weekdays = listWeekdays;\n hooks.parseZone = createInZone;\n hooks.localeData = getLocale;\n hooks.isDuration = isDuration;\n hooks.monthsShort = listMonthsShort;\n hooks.weekdaysMin = listWeekdaysMin;\n hooks.defineLocale = defineLocale;\n hooks.updateLocale = updateLocale;\n hooks.locales = listLocales;\n hooks.weekdaysShort = listWeekdaysShort;\n hooks.normalizeUnits = normalizeUnits;\n hooks.relativeTimeRounding = getSetRelativeTimeRounding;\n hooks.relativeTimeThreshold = getSetRelativeTimeThreshold;\n hooks.calendarFormat = getCalendarFormat;\n hooks.prototype = proto;\n\n // currently HTML5 input type only supports 24-hour formats\n hooks.HTML5_FMT = {\n DATETIME_LOCAL: 'YYYY-MM-DDTHH:mm', // \n DATETIME_LOCAL_SECONDS: 'YYYY-MM-DDTHH:mm:ss', // \n DATETIME_LOCAL_MS: 'YYYY-MM-DDTHH:mm:ss.SSS', // \n DATE: 'YYYY-MM-DD', // \n TIME: 'HH:mm', // \n TIME_SECONDS: 'HH:mm:ss', // \n TIME_MS: 'HH:mm:ss.SSS', // \n WEEK: 'GGGG-[W]WW', // \n MONTH: 'YYYY-MM', // \n };\n\n return hooks;\n\n})));\n","//! moment.js locale configuration\n//! locale : Spanish [es]\n//! author : Julio Napurรญ : https://github.com/julionc\n\n;(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined'\n && typeof require === 'function' ? factory(require('../moment')) :\n typeof define === 'function' && define.amd ? define(['../moment'], factory) :\n factory(global.moment)\n}(this, (function (moment) { 'use strict';\n\n //! moment.js locale configuration\n\n var monthsShortDot =\n 'ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.'.split(\n '_'\n ),\n monthsShort = 'ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic'.split('_'),\n monthsParse = [\n /^ene/i,\n /^feb/i,\n /^mar/i,\n /^abr/i,\n /^may/i,\n /^jun/i,\n /^jul/i,\n /^ago/i,\n /^sep/i,\n /^oct/i,\n /^nov/i,\n /^dic/i,\n ],\n monthsRegex =\n /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\\.?|feb\\.?|mar\\.?|abr\\.?|may\\.?|jun\\.?|jul\\.?|ago\\.?|sep\\.?|oct\\.?|nov\\.?|dic\\.?)/i;\n\n var es = moment.defineLocale('es', {\n months: 'enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre'.split(\n '_'\n ),\n monthsShort: function (m, format) {\n if (!m) {\n return monthsShortDot;\n } else if (/-MMM-/.test(format)) {\n return monthsShort[m.month()];\n } else {\n return monthsShortDot[m.month()];\n }\n },\n monthsRegex: monthsRegex,\n monthsShortRegex: monthsRegex,\n monthsStrictRegex:\n /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i,\n monthsShortStrictRegex:\n /^(ene\\.?|feb\\.?|mar\\.?|abr\\.?|may\\.?|jun\\.?|jul\\.?|ago\\.?|sep\\.?|oct\\.?|nov\\.?|dic\\.?)/i,\n monthsParse: monthsParse,\n longMonthsParse: monthsParse,\n shortMonthsParse: monthsParse,\n weekdays: 'domingo_lunes_martes_miรฉrcoles_jueves_viernes_sรกbado'.split('_'),\n weekdaysShort: 'dom._lun._mar._miรฉ._jue._vie._sรกb.'.split('_'),\n weekdaysMin: 'do_lu_ma_mi_ju_vi_sรก'.split('_'),\n weekdaysParseExact: true,\n longDateFormat: {\n LT: 'H:mm',\n LTS: 'H:mm:ss',\n L: 'DD/MM/YYYY',\n LL: 'D [de] MMMM [de] YYYY',\n LLL: 'D [de] MMMM [de] YYYY H:mm',\n LLLL: 'dddd, D [de] MMMM [de] YYYY H:mm',\n },\n calendar: {\n sameDay: function () {\n return '[hoy a la' + (this.hours() !== 1 ? 's' : '') + '] LT';\n },\n nextDay: function () {\n return '[maรฑana a la' + (this.hours() !== 1 ? 's' : '') + '] LT';\n },\n nextWeek: function () {\n return 'dddd [a la' + (this.hours() !== 1 ? 's' : '') + '] LT';\n },\n lastDay: function () {\n return '[ayer a la' + (this.hours() !== 1 ? 's' : '') + '] LT';\n },\n lastWeek: function () {\n return (\n '[el] dddd [pasado a la' +\n (this.hours() !== 1 ? 's' : '') +\n '] LT'\n );\n },\n sameElse: 'L',\n },\n relativeTime: {\n future: 'en %s',\n past: 'hace %s',\n s: 'unos segundos',\n ss: '%d segundos',\n m: 'un minuto',\n mm: '%d minutos',\n h: 'una hora',\n hh: '%d horas',\n d: 'un dรญa',\n dd: '%d dรญas',\n w: 'una semana',\n ww: '%d semanas',\n M: 'un mes',\n MM: '%d meses',\n y: 'un aรฑo',\n yy: '%d aรฑos',\n },\n dayOfMonthOrdinalParse: /\\d{1,2}ยบ/,\n ordinal: '%dยบ',\n week: {\n dow: 1, // Monday is the first day of the week.\n doy: 4, // The week that contains Jan 4th is the first week of the year.\n },\n invalidDate: 'Fecha invรกlida',\n });\n\n return es;\n\n})));\n","\r\nexport default class ApplicationsChangeLog {\r\n constructor(init) {\r\n\r\n this.modificationTimestamp = null\r\n this.questionKey = null\r\n this.previousValue = null\r\n this.newValue = null\r\n this.changeExplanation = null\r\n this.metaData = null\r\n\r\n if (init) {\r\n\r\n this.modificationTimestamp = init.modificationTimestamp;\r\n this.questionKey = init.questionKey;\r\n this.previousValue = init.previousValue;\r\n this.newValue = init.newValue;\r\n this.changeExplanation = init.changeExplanation;\r\n this.metaData = init.metaData;\r\n }\r\n }\r\n\r\n}\r\n\r\n\r\n\r\n\r\n","import { required, minLength, maxLength, numeric, email } from '@vuelidate/validators'\r\nimport { validDate, validDateOfBirth, validName } from '@core/services/custom-validators'\r\nimport moment from 'moment'\r\n\r\n\r\n\r\nexport default class ApplicationsPreFilledData {\r\n constructor(init) {\r\n this.language = null;\r\n this.firstName = null;\r\n this.lastName = null;\r\n this.dateOfBirth = null;\r\n this.phoneNumber = null;\r\n this.emailAddress = null;\r\n this.storeCode = null;\r\n\r\n if (init) {\r\n this.language = init.language;\r\n this.firstName = init.firstName;\r\n this.lastName = init.lastName;\r\n this.dateOfBirth = init.dateOfBirth ? moment(init.dateOfBirth, \"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\").format(\"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\") : init.dateOfBirth\r\n this.phoneNumber = init.phoneNumber;\r\n this.emailAddress = init.emailAddress;\r\n this.storeCode = init.storeCode;\r\n }\r\n }\r\n\r\n getPropertyValue(propertyName) {\r\n return this[propertyName]\r\n }\r\n\r\n validation() {\r\n let data = {\r\n language: {},\r\n firstName: {},\r\n lastName: {},\r\n dateOfBirth: {},\r\n phoneNumber: {},\r\n emailAddress: {},\r\n storeCode: {}\r\n }\r\n\r\n data.firstName = {\r\n required,\r\n valid: validName\r\n }\r\n data.lastName = {\r\n required ,\r\n valid: validName\r\n };\r\n data.dateOfBirth= { required, validDate, validDateOfBirth, minLength: minLength(10) }\r\n data.emailAddress= { required, email }\r\n data.phoneNumber= { required, numeric, minLength: minLength(10), maxLength: maxLength(10) }\r\n data.language= { required }\r\n\r\n return data;\r\n }\r\n}","const creditApp = {\r\n summaryQuestiom: {\r\n English: \"Please, review all the information above and confirm if it matches your Driver License\",\r\n Spanish: \"Por favor, revise toda la informacion anterior y confirme si coincide con su licencia de conducir\"\r\n },\r\n termsOfUseTitle: {\r\n English: \"Terms, Conditions & Notices\",\r\n Spanish: \"Tรฉrminos, Condiciones y Avisos\"\r\n },\r\n termsOfUseInstruction: {\r\n English: \"Please review the terms and conditions before proceeding.\",\r\n Spanish: \"Por favor revise los tรฉrminos y condiciones antes de continuar.\"\r\n },\r\n //termsOfUseText: {\r\n // //English: \"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur sagittis posuere interdum. Duis rutrum mattis placerat. Integer egestas convallis bibendum. Nullam sed mauris lorem. In sit amet lorem sit amet dolor mattis rhoncus. Integer lacinia pellentesque elit. Duis volutpat tortor velit, nec volutpat mauris sodales non. Donec aliquam velit mi, sit amet maximus sem varius nec. Aenean ante augue, commodo ac interdum sodales, efficitur at turpis.Pellentesque cursus at justo in mattis.Quisque luctus eleifend est, gravida viverra felis vestibulum et.Suspendisse accumsan nulla id neque mollis, et dignissim mi maximus.Vestibulum vitae viverra diam.Sed sit amet rutrum nulla.Donec varius mi eu diam efficitur ullamcorper. Aliquam erat volutpat.Sed bibendum ante consequat arcu suscipit rutrum eget ut tortor.Curabitur congue pulvinar posuere.Morbi eu elit nulla.Nunc non nibh sit amet enim imperdiet facilisis.In suscipit nec dolor vel convallis.Aliquam porta rutrum pretium. Ut accumsan ultrices justo, at pulvinar magna maximus non. Nulla blandit accumsan accumsan. Donec nec scelerisque enim. Vestibulum eget dolor sapien. Pellentesque rutrum augue turpis, at consequat risus eleifend eu. Cras vestibulum nisl sit amet erat venenatis, nec gravida mauris blandit. Phasellus dictum sollicitudin ante id egestas. In sed augue sed sapien vulputate gravida quis ac sapien.Interdum et malesuada fames ac ante ipsum primis in faucibus.Vestibulum sodales lorem felis.Praesent a erat auctor, condimentum lorem ut, accumsan odio.Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.Donec vehicula turpis faucibus venenatis fringilla.Curabitur vitae semper enim.Praesent tincidunt nunc a massa imperdiet accumsan.Morbi malesuada dolor id nunc posuere tristique.Suspendisse potenti. In consectetur orci in felis tincidunt vehicula.Integer viverra convallis elit tempus faucibus.Praesent in nisi ut risus sagittis mattis.In pharetra felis nulla, ut porta urna mollis ac.Morbi faucibus tortor at nisi facilisis, ut facilisis tellus iaculis.Nam vitae molestie metus.Quisque sed molestie risus.Ut nisi nunc, ornare eget tortor lobortis, venenatis ornare tortor.\",\r\n // //Spanish: \"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur sagittis posuere interdum. Duis rutrum mattis placerat. Integer egestas convallis bibendum. Nullam sed mauris lorem. In sit amet lorem sit amet dolor mattis rhoncus. Integer lacinia pellentesque elit. Duis volutpat tortor velit, nec volutpat mauris sodales non. Donec aliquam velit mi, sit amet maximus sem varius nec. Aenean ante augue, commodo ac interdum sodales, efficitur at turpis.Pellentesque cursus at justo in mattis.Quisque luctus eleifend est, gravida viverra felis vestibulum et.Suspendisse accumsan nulla id neque mollis, et dignissim mi maximus.Vestibulum vitae viverra diam.Sed sit amet rutrum nulla.Donec varius mi eu diam efficitur ullamcorper. Aliquam erat volutpat.Sed bibendum ante consequat arcu suscipit rutrum eget ut tortor.Curabitur congue pulvinar posuere.Morbi eu elit nulla.Nunc non nibh sit amet enim imperdiet facilisis.In suscipit nec dolor vel convallis.Aliquam porta rutrum pretium. Ut accumsan ultrices justo, at pulvinar magna maximus non. Nulla blandit accumsan accumsan. Donec nec scelerisque enim. Vestibulum eget dolor sapien. Pellentesque rutrum augue turpis, at consequat risus eleifend eu. Cras vestibulum nisl sit amet erat venenatis, nec gravida mauris blandit. Phasellus dictum sollicitudin ante id egestas. In sed augue sed sapien vulputate gravida quis ac sapien.Interdum et malesuada fames ac ante ipsum primis in faucibus.Vestibulum sodales lorem felis.Praesent a erat auctor, condimentum lorem ut, accumsan odio.Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.Donec vehicula turpis faucibus venenatis fringilla.Curabitur vitae semper enim.Praesent tincidunt nunc a massa imperdiet accumsan.Morbi malesuada dolor id nunc posuere tristique.Suspendisse potenti. In consectetur orci in felis tincidunt vehicula.Integer viverra convallis elit tempus faucibus.Praesent in nisi ut risus sagittis mattis.In pharetra felis nulla, ut porta urna mollis ac.Morbi faucibus tortor at nisi facilisis, ut facilisis tellus iaculis.Nam vitae molestie metus.Quisque sed molestie risus.Ut nisi nunc, ornare eget tortor lobortis, venenatis ornare tortor.\"\r\n //},\r\n loginPage: {\r\n quote: {\r\n English: \"Quote Application\",\r\n Spanish: \"Solicitud de Cotizaciรณn\"\r\n },\r\n quoteCodeSendCodeNote: {\r\n English: \"A security code will be sent to: \",\r\n Spanish: \"Se enviarรก un cรณdigo de seguridad a: \"\r\n },\r\n verifyPhoneText: {\r\n English: \"Verify Phone\",\r\n Spanish: \"Verificar Telรฉfono\"\r\n },\r\n codeSentMessage: {\r\n English: \"Code Sent\",\r\n Spanish: \"Codigo Enviado\"\r\n },\r\n quoteCodeNote: {\r\n English: \"Please enter the security code sent to: \",\r\n Spanish: \"Por favor, ingrese el cรณdigo de seguridad enviado a:\"\r\n },\r\n quoteLoginError: {\r\n English: \"Verification Attempt failed. Wrong or Expired Code.\",\r\n Spanish: \"Intento de Verificaciรณn Fallido. Cรณdigo Icorrecto o Expirado.\"\r\n },\r\n quoteLoginSendCodeButton: {\r\n English: 'Send Code',\r\n Spanish: 'Envia codigo'\r\n },\r\n quoteLoginButton: {\r\n English: \"Continue\",\r\n Spanish: \"Continuar\"\r\n },\r\n quoteLoginFormPlaceholder: {\r\n English: \"Security Code\",\r\n Spanish: \"Cรณdigo de Seguridad\"\r\n },\r\n resendVerificationCode: {\r\n English: \"Resend Verification Code\",\r\n Spanish: \"Reenviar Cรณdigo de verificaciรณn\"\r\n }\r\n },\r\n creationPage: {\r\n applicantInfo: {\r\n English: \"Applicant Info\",\r\n Spanish: \"Informaciรณn del Aplicante\"\r\n },\r\n firstName: {\r\n English: \"First Name\",\r\n Spanish: \"Primer Nombre\"\r\n },\r\n lastName: {\r\n English: \"Last Name\",\r\n Spanish: \"Apellido(s)\"\r\n },\r\n dateOfBirth: {\r\n English: \"Date of Birth\",\r\n Spanish: \"Fecha de Nacimiento\"\r\n },\r\n dateOfBirthFormatMessage: {\r\n English: \"MM/DD/YYYY format is required\",\r\n Spanish: \"MM/DD/YYYY formato es requerido\"\r\n },\r\n dateOfBirthUnderageMessage: {\r\n English: \"You must be 18 years or older\",\r\n Spanish: \"Debe tener 18 aรฑos o mรกs.\"\r\n },\r\n emailAddress: {\r\n English: \"Email Address\",\r\n Spanish: \"Correo Electrรณnico\"\r\n },\r\n phoneNumber: {\r\n English: \"Phone Number\",\r\n Spanish: \"Nรบmero de Telรฉfono\"\r\n },\r\n iAcknowledge: {\r\n English: \"I acknowledge that I have read the\",\r\n Spanish: \"Yo afirmo que he leรญdo la\"\r\n },\r\n privacyPolicy: {\r\n English: \"Privacy Policy\",\r\n Spanish: \"Pรณliza de Privacidad\"\r\n },\r\n smsConsentButton: {\r\n English: \"SMS terms and conditions\",\r\n Spanish: \"tรฉrminos y condiciones de los SMS\"\r\n },\r\n smsConsentText: {\r\n English: \"and that I consent to being contacted by texts/calls, which may be pre-recorded and via autodialer\",\r\n Spanish: \"y doy mi consentimiento para que me contacten mediante mensajes de texto/llamadas, que pueden ser pregrabados y mediante marcador automรกtico.\"\r\n },\r\n createApplication: {\r\n English: \"Create Application\",\r\n Spanish: \"Crear Aplicaciรณn\"\r\n },\r\n createSuccessMessage: {\r\n English: \"Congratulations, {namePrefilled}

Your quote request has been successfully submitted.

Thank you for taking this important step with {storeName}. We are committed to providing you with the best service possible and helping you find your perfect vehicle.

An email with further instructions has been sent to {emailPrefilled}. Please check your inbox and follow the instructions to proceed.

We appreciate your interest in {storeName} and are eager to assist you in your car buying journey. If you have any immediate questions or concerns, please don't hesitate to contact us at {storePhone}.

Thank you again for choosing {storeName}. We look forward to serving you soon!\",\r\n Spanish: \"Felicidades, {namePrefilled}

Su solicitud de cotizaciรณn ha sido enviada con รฉxito.

Gracias por dar este importante paso con {storeName}. Estamos comprometidos a proporcionarle el mejor servicio posible y ayudarle a encontrar su vehรญculo perfecto.

Se ha enviado un correo electrรณnico con instrucciones adicionales a {emailPrefilled}. Por favor, revise su bandeja de entrada y siga las instrucciones para proceder.

Agradecemos su interรฉs en {storeName} y estamos ansiosos por ayudarle en su viaje de compra de un coche. Si tiene alguna pregunta o inquietud inmediata, no dude en contactarnos al {storePhone}.

Gracias nuevamente por elegir {storeName}. ยกEsperamos servirle pronto!\"\r\n },\r\n createSuccessMessageInStore1: {\r\n English: \"Congratulations, {namePrefilled}

Your quote request has been successfully submitted.

Thank you for taking this important step with {storeName}. We are committed to providing you with the best service possible and helping you find your perfect vehicle.

To proceed with your application, please click on the link below:

\",\r\n Spanish: \"Felicidades, {namePrefilled}

Su solicitud de cotizaciรณn ha sido enviada con รฉxito.

Gracias por dar este importante paso con {storeName}. Estamos comprometidos a proporcionarle el mejor servicio posible y ayudarle a encontrar su vehรญculo perfecto.

Para continuar con su solicitud de cotizaciรณn, por favor haga clic en el enlace a continuaciรณn:

\"\r\n },\r\n createSuccessMessageInStore2: {\r\n English: \"
We appreciate your interest in {storeName} and are eager to assist you in your car buying journey. If you have any immediate questions or concerns, please don't hesitate to contact us at {storePhone}.

Thank you again for choosing {storeName}. We look forward to serving you soon!\",\r\n Spanish: \"
Agradecemos su interรฉs en {storeName} y estamos ansiosos por ayudarle en su viaje de compra de un coche. Si tiene alguna pregunta o inquietud inmediata, no dude en contactarnos al {storePhone}.

Gracias nuevamente por elegir {storeName}. ยกEsperamos servirle pronto!\"\r\n },\r\n startApplication: {\r\n English: \"Start application\",\r\n Spanish: \"Comenzar application\"\r\n },\r\n createErrorMessage: {\r\n English: \"Oops...\",\r\n Spanish: \"SPANISH -- Oops...\"\r\n }, createErrorMessage2: {\r\n English: \"Something went wrong.\",\r\n Spanish: \"lso saliรณ mal.\"\r\n },\r\n createErrorAction: {\r\n English: \"Get me out of here\",\r\n Spanish: \"SPANISH -- Sรกqueme de aquรญ\"\r\n },\r\n requiredMessage: {\r\n English: \"This field is required\",\r\n Spanish: \"Este campo es requerido\" \r\n },\r\n nameValidationMessage: {\r\n English: \"The field contains special characters that are not allowed.\",\r\n Spanish: \"El campo contiene caracteres especiales que no estรกn permitidos.\"\r\n }\r\n },\r\n\r\n\r\n}\r\nconst validations = {\r\n\r\n}\r\n\r\nconst miscellaneous = {\r\n selectYear: {\r\n English: \"-- Year --\",\r\n Spanish: \"-- Aรฑo --\"\r\n },\r\n selectMonth: {\r\n English: \"-- Month --\",\r\n Spanish: \"-- Mes --\"\r\n },\r\n selectDay: {\r\n English: \"-- Day --\",\r\n Spanish: \"-- Dรญa --\"\r\n },\r\n months: {\r\n English: [\r\n { text: 'January', value: 1 },\r\n { text: 'February', value: 2 },\r\n { text: 'March', value: 3 },\r\n { text: 'April', value: 4 },\r\n { text: 'May', value: 5 },\r\n { text: 'June', value: 6 },\r\n { text: 'July', value: 7 },\r\n { text: 'August', value: 8 },\r\n { text: 'September', value: 9 },\r\n { text: 'October', value: 10 },\r\n { text: 'November', value: 11 },\r\n { text: 'December', value: 12 },\r\n ],\r\n Spanish: [\r\n { text: 'Enero', value: 1 },\r\n { text: 'Febrero', value: 2 },\r\n { text: 'Marzo', value: 3 },\r\n { text: 'Abril', value: 4 },\r\n { text: 'Mayo', value: 5 },\r\n { text: 'Junio', value: 6 },\r\n { text: 'Julio', value: 7 },\r\n { text: 'Agosto', value: 8 },\r\n { text: 'Septiembre', value: 9 },\r\n { text: 'Octubre', value: 10 },\r\n { text: 'Noviembre', value: 11 },\r\n { text: 'Diciembre', value: 12 },\r\n ]\r\n },\r\n statusMessage: {\r\n English: \"Fafa - English\",\r\n Spanish: \"fafa\"\r\n }\r\n}\r\n\r\nconst categories = {\r\n personal: {\r\n English: 'Personal',\r\n Spanish: 'Personal'\r\n },\r\n //incentives: {\r\n // English: 'Incentives',\r\n // Spanish: 'Incentivos'\r\n //},\r\n //quote: {\r\n // English: 'Quote',\r\n // Spanish: 'Cotizaciรณn'\r\n //},\r\n creditApp: {\r\n English: 'Application',\r\n Spanish: 'Aplicacรญon'\r\n },\r\n thankYou: {\r\n English: 'Thanks',\r\n Spanish: 'Gracias'\r\n }\r\n}\r\n\r\n\r\nconst buttonLabels = {\r\n acceptTerms: {\r\n English: \"Accept Terms\",\r\n Spanish: \"Aceptar los Tรฉrminos\"\r\n },\r\n yes: {\r\n English: \"Yes\",\r\n Spanish: \"Si\"\r\n },\r\n no: {\r\n English: \"No\",\r\n Spanish: \"No\"\r\n },\r\n yesSummary: {\r\n English: \"Yes\",\r\n Spanish: \"Si\"\r\n },\r\n noSummary: {\r\n English: \"No\",\r\n Spanish: \"No\"\r\n },\r\n continue: {\r\n English: \"Continue\",\r\n Spanish: \"Continuar\"\r\n },\r\n procedeWithoutPlaidLink: {\r\n English: \"I'm unable to verify my identity at the moment.\",\r\n Spanish: \"No puedo verificar mi identidad en este momento.\"\r\n },\r\n getEstimatedQuotePerson: {\r\n English: \"I would prefer an inaccurate quote and to not share my social security number at this time.\",\r\n Spanish: \"Preferirรญa una cotizaciรณn inexacta y no compartir mi nรบmero de seguro social en este momento.\"\r\n },\r\n getEstimatedQuoteBusiness: {\r\n English: \"I would prefer an inaccurate quote and to not share the company tax Id at this time.\",\r\n Spanish: \"Preferirรญa una cotizaciรณn inexacta y no compartir la identificacion tributaria de la compaรฑรญa en este momento.\"\r\n },\r\n none: {\r\n English: \"None\",\r\n Spanish: \"Ninguno\"\r\n },\r\n plate: {\r\n English: \"License Plate\",\r\n Spanish: \"Nรบmero de Placa\"\r\n },\r\n vin: {\r\n English: \"Vehicle Identification # (VIN)\",\r\n Spanish: \"Identificaciรณn del vehรญculo (VIN)\"\r\n },\r\n neither: {\r\n English: \"Neither\",\r\n Spanish: \"Ninguno\"\r\n },\r\n\r\n usePin: {\r\n English: \"Use this PIN\",\r\n Spanish: \"Usar este PIN\"\r\n },\r\n dontHavePin: {\r\n English: \"Do not have the PIN\",\r\n Spanish: \"No tengo el PIN\"\r\n },\r\n both: {\r\n English: \"Both\",\r\n Spanish: \"Ambos\"\r\n },\r\n myself: {\r\n English: \"Myself\",\r\n Spanish: \"Yo\"\r\n },\r\n child: {\r\n English: \"Child\",\r\n Spanish: \"Hijo(a)\"\r\n },\r\n insurance: {\r\n English: \"Insurance Only\",\r\n Spanish: \"Solo Seguro\"\r\n },\r\n taxes: {\r\n English: \"Taxes Only\",\r\n Spanish: \"Solo Impuestos\"\r\n },\r\n army: { //El\r\n English: \"Army\",\r\n Spanish: \"Ejercito\"\r\n },\r\n navy: { //La\r\n English: \"Navy\",\r\n Spanish: \"Marina de Guerra\"\r\n },\r\n airForce: { //La\r\n English: \"Air Force\",\r\n Spanish: \"Fuerza Aerea\"\r\n },\r\n nationalGuard: { //La\r\n English: \"National Guard\",\r\n Spanish: \"Guardia National\"\r\n },\r\n marines: { //La\r\n English: \"Marines\",\r\n Spanish: \"Infanterรญa de Marina\"\r\n },\r\n coastGuard: { //La\r\n English: \"Coast Guard\",\r\n Spanish: \"Guardia Costera\"\r\n },\r\n active: {\r\n English: \"Active\",\r\n Spanish: \"Activo(a)\"\r\n },\r\n veteran: {\r\n English: \"Veteran\",\r\n Spanish: \"Veterano(a)\"\r\n },\r\n inactive: {\r\n English: \"Inactive\",\r\n Spanish: \"Inactivo(a)\"\r\n },\r\n reservist: {\r\n English: \"Reservist\",\r\n Spanish: \"Reserva\"\r\n },\r\n fullTime: {\r\n English: \"Full-Time\",\r\n Spanish: \"Tiempo completo\"\r\n },\r\n partTime: {\r\n English: \"Part-Time\",\r\n Spanish: \"Medio Tiempo\"\r\n },\r\n graduated: {\r\n English: \"Graduated\",\r\n Spanish: \"Graduado\"\r\n },\r\n academicLeave: {\r\n English: \"Academic Leave\",\r\n Spanish: \"Licencia Acadรฉmica\"\r\n },\r\n highSchool: {\r\n English: \"High School\",\r\n Spanish: \"Preuniversitario / Tรฉcnico Medio\"\r\n },\r\n college: {\r\n English: \"College\",\r\n Spanish: \"Colegio Universitario\"\r\n },\r\n university: {\r\n English: \"University\",\r\n Spanish: \"Universidad\"\r\n },\r\n tradeSchool: {\r\n English: \"Trade School\",\r\n Spanish: \"Escuela de Oficios\"\r\n },\r\n registeredNursingSchool: { //?????????????????????????????????\r\n English: \"Registered Nursing School\",\r\n Spanish: \"Escuela de Enfermerรญa Registrada\"\r\n },\r\n nursingSchool: {\r\n English: \"Nursing School\",\r\n Spanish: \"Escuela de Enfermerรญa\"\r\n },\r\n nar: {\r\n English: \"National Association of Realtors (NAR)\",\r\n Spanish: \"National Association of Realtors (NAR)\",\r\n //Spanish: \"Asociaciรณn Nacional de Agentes Inmobiliarios(NAR)\"\r\n },\r\n ffa: {\r\n English: \"Future Farmers of America (FFA)\",\r\n Spanish: \"Future Farmers of America (FFA)\",\r\n //Spanish: \"Futuros agricultores de Amรฉrica(FFA)\"\r\n },\r\n fba: {\r\n English: \"Farm Bureau Association (FBA)\",\r\n Spanish: \"Farm Bureau Association (FBA)\",\r\n //Spanish: \"Asociaciรณn de Oficinas Agrรญcolas(FBA)\"\r\n },\r\n dfa: {\r\n English: \"Dairy Farmers of America (DFA)\",\r\n Spanish: \"Dairy Farmers of America (DFA)\",\r\n //Spanish: \"Granjeros Lรกcteos de Amรฉrica(DFA)\"\r\n },\r\n nari: {\r\n English: \"National Association of Remodelers Industry (NARI)\",\r\n Spanish: \"National Association of Remodelers Industry (NARI)\",\r\n //Spanish: \"Asociaciรณn Nacional de la Industria de Remodeladores(NARI)\"\r\n },\r\n nfib: {\r\n English: \"National Federation of Independent Businesses (NFIB)\",\r\n Spanish: \"National Federation of Independent Businesses (NFIB)\",\r\n //Spanish: \"Federaciรณn Nacional de Empresas Independientes(NFIB)\"\r\n },\r\n nfda: {\r\n English: \"National Funeral Directors Association (NFDA)\",\r\n Spanish: \"National Funeral Directors Association (NFDA)\",\r\n //Spanish: \"Asociaciรณn Nacional de Directores de Funerarias(NFDA)\"\r\n },\r\n back: {\r\n English: \"Back\",\r\n Spanish: \"Atras\"\r\n },\r\n own: {\r\n English: \"Own\",\r\n Spanish: \"Poseo\"\r\n },\r\n parents: {\r\n English: \"Parents\",\r\n Spanish: \"Padres\"\r\n },\r\n siblings: {\r\n English: \"Siblings\",\r\n Spanish: \"Hermanos\"\r\n },\r\n other: {\r\n English: \"Other\",\r\n Spanish: \"Otro\"\r\n },\r\n retired: {\r\n English: \"Retired\",\r\n Spanish: \"Retirado(a)\"\r\n },\r\n disabled: {\r\n English: \"Disabled\",\r\n Spanish: \"Desabilitado(a)\"\r\n },\r\n student: {\r\n English: \"Student\",\r\n Spanish: \"Estudiante\"\r\n },\r\n unemployed: {\r\n English: \"Unemployed\",\r\n Spanish: \"Desempleado(a)\"\r\n },\r\n hourly: {\r\n English: \"Hourly\",\r\n Spanish: \"Por hora\"\r\n },\r\n salary: {\r\n English: \"Salary\",\r\n Spanish: \"Salario\"\r\n },\r\n weekly: {\r\n English: \"Weekly\",\r\n Spanish: \"Semanalmente\"\r\n },\r\n biWeekly: {\r\n English: \"BiWeekly\",\r\n Spanish: \"Quincenalmente\"\r\n },\r\n monthly: {\r\n English: \"Monthly\",\r\n Spanish: \"Mensualmente\"\r\n },\r\n quarterly: {\r\n English: \"Quarterly\",\r\n Spanish: \"Trimestralmente\"\r\n },\r\n semiAnnual: {\r\n English: \"Semi-Annual\",\r\n Spanish: \"Semestralmente\"\r\n },\r\n annually: {\r\n English: \"Annually\",\r\n Spanish: \"Anualmente\"\r\n },\r\n cash: {\r\n English: \"Cash\",\r\n Spanish: \"Efectivo\"\r\n },\r\n finance: {\r\n English: \"Finance\",\r\n Spanish: \"Financiado\"\r\n },\r\n lease: {\r\n English: \"Lease\",\r\n Spanish: \"Arrendamiento\"\r\n },\r\n //States\r\n florida: {\r\n English: \"Florida\",\r\n Spanish: \"Florida\",\r\n },\r\n\r\n\r\n\r\n\r\n // Please briefly describe\r\n // Por favor describa breviamente\r\n\r\n //**** INFO FOR MILITARY CURRENT EMPLOYER ****\r\n //provideMilitaryCurrentEmployerName\r\n //provideMilitaryCurrentEmployerPhoneNumber\r\n //provideMilitaryCurrentEmployerPosition\r\n //provideMilitaryCurrentEmployerSupervisorName\r\n //provideMilitaryCurrentEmployerSupervisorPhoneNumber\r\n //provideMilitaryCurrentEmployerStartedDate ***** ONLY MONTH AND YEAR\r\n\r\n //**** INFO FOR CURRENT EMPLOYER ****\r\n //provideCurrentEmployerName\r\n //provideCurrentEmployerPhoneNumber\r\n //provideCurrentEmployerPosition\r\n //provideCurrentEmployerSupervisorName\r\n //provideCurrentEmployerSupervisorPhoneNumber\r\n //provideCurrentEmployerStartedDate ***** ONLY MONTH AND YEAR\r\n\r\n //**** INFO FOR MILITARY CURRENT EMPLOYER ****\r\n //providePreviousEmployerName\r\n //providePreviousEmployerPhoneNumber\r\n //providePreviousEmployerPosition\r\n //providePreviousEmployerStartedDate ***** ONLY MONTH AND YEAR\r\n\r\n //**** INFO FOR CURRENT EMPLOYER ****\r\n //provideMilitaryPreviousEmployerName\r\n //provideMilitaryPreviousEmployerPhoneNumber\r\n //provideMilitaryPreviousEmployerPosition\r\n //provideMilitaryPreviousEmployerStartedDate ***** ONLY MONTH AND YEAR\r\n\r\n\r\n\r\n\r\n\r\n}\r\n\r\n/// CUSTOMER PORTAL /////\r\n\r\nconst customerPortalNavBar = {\r\n garageTitle: {\r\n English: \"My Garage\",\r\n Spanish: \"Mi Garaje\"\r\n },\r\n profileTitle: {\r\n English: \"Profile\",\r\n Spanish: \"Perfil\"\r\n },\r\n\r\n}\r\n\r\nconst customerPortalHomePage = {\r\n welcome: {\r\n English: \"Welcome,\",\r\n Spanish: \"Bienvenido,\"\r\n },\r\n applicationWidgetSubtextPartialCompleted: {\r\n English: \"Complete your application.\",\r\n Spanish: \"Complete su aplicaciรณn.\"\r\n },\r\n applicationWidgetSubtextCompletedNC: {\r\n English: \"See the best rates we can get you based on your credit and other factors.\",\r\n Spanish: \"Consulte cuales son las mejores tasas segรบn su crรฉdito y otros factores.\"\r\n },\r\n applicationWidgetTitlePartialCompleted: {\r\n English: \"Complete Your Profile\",\r\n Spanish: \"Complete su Perfil.\"\r\n },\r\n applicationWidgetTitleCompletedNC: {\r\n English: \"Credit Application\",\r\n Spanish: \"Aplicaciรณn de Crรฉdito\"\r\n },\r\n applicationWidgetButtonTextCompleted: {\r\n English: \"View/Edit Application\",\r\n Spanish: \"Ver/Editar su Aplicaciรณn\"\r\n },\r\n applicationWidgetButtonTextCompletedNC: {\r\n English: \"Start Application\",\r\n Spanish: \"Inicia su Aplicaciรณn\"\r\n },\r\n IDVWidgetTitle: {\r\n English: \"Identification\",\r\n Spanish: \"Identificaciรณn\"\r\n },\r\n IDVWidgetSubtext: {\r\n English: \"Upload a form of identification to speed up the process.\", \r\n Spanish: \"Suba una forma de identificaciรณn para agilizar el proceso.\" \r\n },\r\n IDVWidgetButtonText: {\r\n English: \"Upload ID\",\r\n Spanish: \"Subir Identificaciรณn\" \r\n },\r\n businessWidgetExistsTitle: {\r\n English: \"Business Information\",\r\n Spanish: \"Informacion de la Compaรฑรญa\"\r\n },\r\n businessWidgetTitle: {\r\n English: \"Add a Business\",\r\n Spanish: \"Agregar una Compaรฑรญa\"\r\n },\r\n businessWidgetExistsSubtext: {\r\n English: \"View your business.\",\r\n Spanish: \"Ver su compaรฑรญa.\"\r\n },\r\n businessWidgetSubtext: {\r\n English: \"Add your business for an easier check out process.\",\r\n Spanish: \"Agrega su para un proceso de pago mรกs fรกcil.\"\r\n },\r\n businessWidgetExistButtonText: {\r\n English: \"View Business\",\r\n Spanish: \"Ver Compaรฑรญa\"\r\n },\r\n businessWidgetButtonText: {\r\n English: \"Add Business\",\r\n Spanish: \"Agregar Compaรฑรญa\"\r\n },\r\n garageWidgetTitle: {\r\n English: \"My Garage\",\r\n Spanish: \"Mi Garaje\"\r\n },\r\n garageWidgetSubtext: {\r\n English: \"Take a look at the vehicles you own or lease.\",\r\n Spanish: \"Consulte los vehรญculos que posees o arriendas.\"\r\n },\r\n garageWidgetButtonText: {\r\n English: \"Access Garage\",\r\n Spanish: \"Accede a su Garaje\"\r\n },\r\n}\r\n\r\n\r\nconst customerPortalGaragePage = {\r\n garagePageTitle: { \r\n English: \"My Garage\",\r\n Spanish: \"Mi Garaje\"\r\n },\r\n garagePageAddButtonText: {\r\n English: \"Add Vehicle\",\r\n Spanish: \"Agregue Vehรญculo\"\r\n },\r\n garageRemoveVehicleTitle: {\r\n English: \"Remove Vehicle\",\r\n Spanish: \"Eliminar Vehรญculo\"\r\n },\r\n garageRemoveVehicleSubtext: {\r\n English: \"Are you sure you want to remove this vehicle from your garage? This action is not reversible.\",\r\n Spanish: \"ยฟEstรกs seguro de que deseas eliminar este vehรญculo de su garaje? Esta acciรณn no se puede reevertir.\"\r\n },\r\n acceptText: {\r\n English: \"Continue\",\r\n Spanish: \"Continuar\"\r\n },\r\n cancelText: {\r\n English: \"Cancel\",\r\n Spanish: \"Cancelar\"\r\n },\r\n menuActionsRemovalVehicleText: {\r\n English: \"Remove vehicle\",\r\n Spanish: \"Eliminar vehรญculo\"\r\n },\r\n cardSubtextUnknown: {\r\n English: \"Unknown\",\r\n Spanish: \"Desconocido\" \r\n },\r\n cardSubtextSentence: {\r\n English: \"vehicle in garage\",\r\n Spanish: \"vehรญculo en el garaje\"\r\n }\r\n}\r\n\r\n\r\nconst customerPortalProfilePage = {\r\n conditionalSectionHeaderTitle: {\r\n English: \"Profile Information\",\r\n Spanish: \"Informaciรณn de Perfil\"\r\n },\r\n sectionsPersonalTitle: {\r\n English: \"Personal Information\",\r\n Spanish: \"Informaciรณn Personal\"\r\n },\r\n sectionHousingTitle: {\r\n English: \"Housing\",\r\n Spanish: \"Vivienda\"\r\n },\r\n sectionEmploymentTitle: {\r\n English: \"Employment\",\r\n Spanish: \"Empleo\"\r\n },\r\n sectionBusinessTitle: {\r\n English: \"Business(es)\",\r\n Spanish: \"Compaรฑรญa(s)\"\r\n }\r\n}\r\n\r\n\r\nconst customerPortalPersonalInfoSection = {\r\n editSectionText: {\r\n English: \"Edit Section\",\r\n Spanish: \"Editar Secciรณn\"\r\n },\r\n editSSNText: {\r\n English: \"Edit SSN\",\r\n Spanish: \"Editar Nรบmero de Seguro Social\"\r\n },\r\n sectionTitleText: {\r\n English: \"Personal Information\",\r\n Spanish: \"Informaciรณn Personal\"\r\n },\r\n emailText: {\r\n English: \"No email provided\",\r\n Spanish: \"No se proporcionรณ un correo electrรณnico\"\r\n },\r\n nameText: {\r\n English: \"No name provided\",\r\n Spanish: \"No se proporcionรณ un nombre\"\r\n },\r\n dobText: {\r\n English: \"No date of birth provided\",\r\n Spanish: \"No se proporcionรณ una fecha de nacimiento\"\r\n },\r\n phoneText: {\r\n English: \"No phone provided\",\r\n Spanish: \"No se proporcionรณ un telรฉfono\"\r\n },\r\n ssnText: {\r\n English: \"No SSN provided\",\r\n Spanish: \"No se proporcionรณ un Numero de Seguro Social\"\r\n },\r\n languageText: {\r\n English: \"Unknown\",\r\n Spanish: \"Desconocido\"\r\n },\r\n addressText: {\r\n English: \"No address provided\",\r\n Spanish: \"No se proporcionรณ una direcciรณn\"\r\n },\r\n submitText: {\r\n English: \"Submit\",\r\n Spanish: \"Enviar\"\r\n },\r\n cancelText: {\r\n English: \"Cancel\",\r\n Spanish: \"Cancelar\"\r\n },\r\n emailValidationText: {\r\n English: \"Please enter a valid email.\",\r\n Spanish: \"Por favor, ingrese un correo electrรณnico vรกlido.\"\r\n },\r\n phoneValidationText: {\r\n English: \"Please enter a valid phone.\",\r\n Spanish: \"Por favor, ingrese un telรฉfono vรกlido.\"\r\n },\r\n emailModalTitle: {\r\n English: \"Verify Your Email\",\r\n Spanish: \"Verifica su correo electrรณnico\"\r\n },\r\n emailModalSubtext: {\r\n English: \"Please enter the code we sent to:\",\r\n Spanish: \"Por favor, ingrese el cรณdigo que enviamos a:\"\r\n },\r\n phoneModalTitle: {\r\n English: \"Verify Your Phone Number\",\r\n Spanish: \"Verifica su nรบmero de telรฉfono\"\r\n },\r\n phoneModalSubtext: {\r\n English: \"Please enter the code we sent to:\",\r\n Spanish: \"Por favor, ingrese el cรณdigo que enviamos a:\"\r\n },\r\n emailEditPlaceholder: {\r\n English: \"Enter new email\",\r\n Spanish: \"Introduce su nuevo correo electrรณnico\"\r\n }\r\n}\r\n\r\nconst customerPortalHousingInfoSection = {\r\n housingSectionTitle: {\r\n English: \"Housing\",\r\n Spanish: \"Vivienda\" \r\n },\r\n editSectionText: {\r\n English: \"Edit Section\",\r\n Spanish: \"Editar Secciรณn\" \r\n },\r\n housingStatusText: {\r\n English: \"No status provided\",\r\n Spanish: \"No se proporcionรณ un estado\" \r\n },\r\n paymentAmountText: {\r\n English: \" payment\",\r\n Spanish: \" pago\"\r\n },\r\n paymentText: {\r\n English: \"No payment provided\",\r\n Spanish: \"No se proporcionรณ un pago\" \r\n },\r\n moveInDateText: {\r\n English: \"No move in date provided\",\r\n Spanish: \"No se proporcionรณ una fecha de mudanza\" \r\n },\r\n sinceText: {\r\n English: \"Since \",\r\n Spanish: \"Desde \" \r\n },\r\n}\r\n\r\n\r\nconst customerPortalEmploymentInfoSection = {\r\n housingSectionTitle: {\r\n English: \"Employment\",\r\n Spanish: \"Empleo\" \r\n },\r\n editSectionText: {\r\n English: \"Edit Section\",\r\n Spanish: \"Editar Secciรณn\" \r\n },\r\n employmentStatusText: {\r\n English: \"No employment status provided\",\r\n Spanish: \"No se proporcionรณ un estado de empleo\" \r\n },\r\n employmentNameText: {\r\n English: \"No employment name provided\",\r\n Spanish: \"No se proporcionรณ un nombre de empleo\" \r\n },\r\n employerPhoneText: {\r\n English: \"No employment phone provided\",\r\n Spanish: \"No se proporcionรณ un telรฉfono de empleo\"\r\n },\r\n employmentPositionText: {\r\n English: \"No employment position provided\",\r\n Spanish: \"No se proporcionรณ un puesto de trabajo\" \r\n },\r\n employmentDateText: {\r\n English: \"No employment dates provided\",\r\n Spanish: \"No se proporcionaron fechas de empleo\" \r\n },\r\n employmentIncomeText: {\r\n English: \"No employment income provided\",\r\n Spanish: \"No se proporcionaron ingresos de empleo\"\r\n },\r\n}\r\n\r\nconst customerPortalBusinessSection = {\r\n businessSectionTitle: {\r\n English: \"Business(es)\",\r\n Spanish: \"Compaรฑรญa(s)\" \r\n },\r\n routeToBusinessText: {\r\n English: \"Go to business page\",\r\n Spanish: \"Ir a la pรกgina de la compaรฑรญa\" \r\n },\r\n}\r\n\r\nconst customerPortalBusinessPage = {\r\n basicBusinessTitle: {\r\n English: \"Basic Business Information\",\r\n Spanish: \"Informaciรณn Bรกsica de la Compaรฑรญa\"\r\n },\r\n businessOperatorTitle: {\r\n English: \"Business Operator\",\r\n Spanish: \"Operador de la Compaรฑรญa\"\r\n },\r\n businessPrincipalTitle: {\r\n English: \"Business Principal\",\r\n Spanish: \"Principal de la Compaรฑรญa\"\r\n },\r\n}\r\n\r\nconst customerPortalBasicBusinessSection = {\r\n sectionTitle: {\r\n English: \"Business Information\",\r\n Spanish: \"Informaciรณn de la Compaรฑรญa\"\r\n },\r\n editSectionText: {\r\n English: \"Edit Section\",\r\n Spanish: \"Editar Secciรณn\"\r\n },\r\n addressNotProvidedText: {\r\n English: \"No addresses provided\",\r\n Spanish: \"No se proporcionaron direcciones\"\r\n },\r\n nameText: {\r\n English: \"No business name provided\",\r\n Spanish: \"No se proporcionรณ el nombre de la Compaรฑรญa\"\r\n },\r\n phoneText: {\r\n English: \"No phone number provided\",\r\n Spanish: \"No se proporcionรณ el nรบmero de telรฉfono\"\r\n },\r\n sinceText: {\r\n English: \"Since \",\r\n Spanish: \"Desde \"\r\n },\r\n startDateText: {\r\n English: \"No start date provided\",\r\n Spanish: \"No se proporcionรณ la fecha de inicio\"\r\n },\r\n yibText: {\r\n English: \" years in business\",\r\n Spanish: \" aรฑos operando\"\r\n },\r\n yearsInBusinessText: {\r\n English: \"Years in business not available\",\r\n Spanish: \"Aรฑos operando no disponible\"\r\n },\r\n taxIDText: {\r\n English: \"Tax ID: \",\r\n Spanish: \"Tax ID: \"\r\n },\r\n taxIDNotProvidedText: {\r\n English: \"No Tax ID provided\",\r\n Spanish: \"No se proporcionรณ el tax ID\"\r\n },\r\n monthlyProfitText: {\r\n English: \"Monthly Profit: \",\r\n Spanish: \"Ganancia Mensual: \"\r\n },\r\n monthlyProfitNotProvidedText: {\r\n English: \"No profit information provided\",\r\n Spanish: \"No se proporcionรณ informaciรณn de ganancias\"\r\n },\r\n residenceStatusNotProvidedText: {\r\n English: \"Location ownership Status not provided \",\r\n Spanish: \"Location ownership status not provided \"\r\n },\r\n}\r\n\r\nconst customerPortalOperatorBusinessSection = {\r\n sectionTitle: {\r\n English: \"Business Operator\",\r\n Spanish: \"Operador de la Compaรฑรญa\"\r\n },\r\n editSectionText: {\r\n English: \"Edit Section\",\r\n Spanish: \"Editar Secciรณn\"\r\n },\r\n addressNotProvidedText: {\r\n English: \"No operator address given\",\r\n Spanish: \"No se proporcionรณ la direcciรณn del operador\"\r\n },\r\n nameText: {\r\n English: \"No operator name given\",\r\n Spanish: \"No se proporcionรณ el nombre del operador\"\r\n },\r\n relationshipNotProvidedText: {\r\n English: \"No operator relationship given\",\r\n Spanish: \"No se proporcionรณ la relaciรณn del operador\"\r\n },\r\n relationshipText: {\r\n English: \"Relationship: \",\r\n Spanish: \"Relaciรณn: \"\r\n }\r\n};\r\n\r\n\r\nconst customerPortalPrincipalBusinessSection = {\r\n sectionTitle: {\r\n English: \"Business Principal\",\r\n Spanish: \"Principal de la Compaรฑรญa\" \r\n },\r\n editSectionText: {\r\n English: \"Edit Section\",\r\n Spanish: \"Editar Secciรณn\" \r\n },\r\n nameNotProvidedText: {\r\n English: \"No principal name given\",\r\n Spanish: \"No se proporcionรณ el nombre del principal\" \r\n },\r\n jobTitleNotProvidedText: {\r\n English: \"No principal job title provided\",\r\n Spanish: \"No se proporcionรณ el puesto de trabajo principal\"\r\n },\r\n percentageOfOwnerText: {\r\n English: \"Percentage Of Ownership: \",\r\n Spanish: \"Porcentaje de Propiedad: \" \r\n },\r\n percentageOfOwnerNotProvidedText: {\r\n English: \"No ownership percentage provided\",\r\n Spanish: \"No se proporcionรณ el porcentaje de propiedad\" \r\n },\r\n dobNotProvidedText: {\r\n English: \"No date of birth provided\",\r\n Spanish: \"No se proporcionรณ fecha de nacimiento\" \r\n },\r\n phoneNotProvidedText: {\r\n English: \"No phone number provided\",\r\n Spanish: \"No se proporcionรณ el nรบmero de telรฉfono\" \r\n },\r\n addressNotProvidedText: {\r\n English: \"No address provided\",\r\n Spanish: \"No se proporcionรณ la direcciรณn\" \r\n },\r\n}\r\n\r\nconst customerPortalIdentityVerificationPage = {\r\n h1VerificationNeeded: {\r\n English: \"Verification Needed\",\r\n Spanish: \"Verificaciรณn Necesaria\",\r\n },\r\n pStartVerification: {\r\n English: \"Please click the button below to start our verification process.\",\r\n Spanish: \"Por favor, haga clic en el botรณn de abajo para iniciar nuestro proceso de verificaciรณn.\",\r\n },\r\n h1DocumentReceived: {\r\n English: \"Document Received\",\r\n Spanish: \"Documento Recibido\",\r\n },\r\n pPendingVerification: {\r\n English: \"Pending Verification...\",\r\n Spanish: \"Verificaciรณn Pendiente...\",\r\n },\r\n //TODO: Continue checking Spanish translation from here\r\n pSafeToGoHome: {\r\n English: \"It is now safe to go back to the home page.\",\r\n Spanish: \"Ahora es seguro volver a la pรกgina principal.\",\r\n },\r\n h1VerificationFailed: {\r\n English: \"Verification Failed\",\r\n Spanish: \"La Verificaciรณn Fallรณ\",\r\n },\r\n pAskRepresentative: {\r\n English: \"Please ask your Dealership Representative for more details.\",\r\n Spanish: \"Por favor, consulte a su representante del concesionario para obtener mรกs detalles.\",\r\n },\r\n h1InvalidID: {\r\n English: \"Invalid ID.\",\r\n Spanish: \"ID No Vรกlido.\",\r\n },\r\n homeButtonText: {\r\n English: \"Home\",\r\n Spanish: \"Inicio\"\r\n }\r\n}\r\n\r\n// Forms \r\nconst customerPortalAddVehicleForm = {\r\n radioQuestionRequired: {\r\n English: \"Please make a selection.\",\r\n Spanish: \"Por favor, haga una selecciรณn.\",\r\n },\r\n sectionTitle: {\r\n English: \"Add a New Vehicle\",\r\n Spanish: \"Agregar Un Nuevo Vehรญculo\"\r\n },\r\n whichQuestionText: {\r\n English: \"Which one of these do you have?\",\r\n Spanish: \"ยฟCuales de estos tienes?\"\r\n },\r\n neitherText: {\r\n English: \"Neither\",\r\n Spanish: \"Ninguno\"\r\n },\r\n plateStateText: {\r\n English: \"Plate State\",\r\n Spanish: \"Estado de Placa\"\r\n },\r\n plateText: {\r\n English: \"USA Plate Number\",\r\n Spanish: \"Nรบmero de Placa De USA\"\r\n },\r\n makeText: {\r\n English: \"Make\",\r\n Spanish: \"Marca\"\r\n },\r\n modelText: {\r\n English: \"Model\",\r\n Spanish: \"Modelo\"\r\n },\r\n styleText: {\r\n English: \"Style\",\r\n Spanish: \"Estilo\"\r\n },\r\n yearText: {\r\n English: \"Year\",\r\n Spanish: \"Aรฑo\"\r\n },\r\n ownershipTypeText: {\r\n English: \"Ownership Type\",\r\n Spanish: \"Tipo de Propiedad\"\r\n },\r\n ownerShipPlaceholderText: {\r\n English: \"Select Ownership Type\",\r\n Spanish: \"Selecciona el Tipo de Propiedad\"\r\n },\r\n saveText: {\r\n English: \"Save Vehicle\",\r\n Spanish: \"Guardar Vehรญculo\"\r\n },\r\n formInvalidText: {\r\n English: \"Please ensure all fields are entered and correct.\",\r\n Spanish: \"Por favor, asegรบrate de que todos los campos estรฉn completos y correctos.\"\r\n },\r\n vinInvalidText: {\r\n English: \"VIN is invalid.\",\r\n Spanish: \"El VIN es invalido.\"\r\n },\r\n vinRequiredText: {\r\n English: \"VIN is required.\",\r\n Spanish: \"El VIN es obligatorio.\"\r\n },\r\n plateStateRequiredText: {\r\n English: \"State is required.\",\r\n Spanish: \"Estado es obligatorio.\"\r\n },\r\n plateNumberRequiredText: {\r\n English: \"Plate number is required.\",\r\n Spanish: \"El numero de la placa es obligatorio.\"\r\n },\r\n makeRequiredText: {\r\n English: \"Make is required.\",\r\n Spanish: \"La marca es obligatoria.\"\r\n },\r\n modelRequiredText: {\r\n English: \"Model is required.\",\r\n Spanish: \"El modelo es obligatorio.\"\r\n },\r\n styleRequiredText: {\r\n English: \"Style is required.\",\r\n Spanish: \"El estilo es obligatorio.\"\r\n },\r\n yearRequiredText: {\r\n English: \"Model year is required.\",\r\n Spanish: \"El aรฑo del modelo es obligatorio.\"\r\n },\r\n yearInvalidText: {\r\n English: \"Model year is invalid.\",\r\n Spanish: \"El aรฑo del modelo es invalido.\"\r\n },\r\n ownershipTypeRequiredText: {\r\n English: \"Ownership relationship type is required.\",\r\n Spanish: \"El tipo de propiedad es obligatorio.\"\r\n },\r\n}\r\n\r\nconst customerPortalAddBusinessForm = {\r\n sectionTitle: {\r\n English: \"Business Information\",\r\n Spanish: \"Informaciรณn de la Compaรฑรญa\",\r\n },\r\n dba: {\r\n English: \"DBA (Doing Business As)\",\r\n Spanish: \"Operando Como (DBA)\",\r\n },\r\n legalName: {\r\n English: \"Business Legal Name\",\r\n Spanish: \"Nombre Legal de la Compaรฑรญa\",\r\n },\r\n entityType: {\r\n English: \"Entity Type\",\r\n Spanish: \"Tipo de Entidad\",\r\n },\r\n businessStartDate: {\r\n English: \"Business Start Date\",\r\n Spanish: \"Fecha de Inicio de la Compaรฑรญa\",\r\n },\r\n businessTaxId: {\r\n English: \"Business Tax ID\",\r\n Spanish: \"Tax ID de la Compaรฑรญa\",\r\n },\r\n grossMonthlyProfit: {\r\n English: \"Gross Monthly Profit of Business\",\r\n Spanish: \"Ganancia Mensual Bruta\",\r\n },\r\n email: {\r\n English: \"Company Email\",\r\n Spanish: \"Email de la Compaรฑรญa\",\r\n },\r\n mainPhoneNumber: {\r\n English: \"Company's Main Phone Number\",\r\n Spanish: \"Telรฉfono de la Compaรฑรญa\",\r\n },\r\n ownershipStatus: {\r\n English: \"Ownership Status of the Company's Location\",\r\n Spanish: \"Estado de Propiedad de la Ubicaciรณn de la Compaรฑรญa\",\r\n },\r\n monthlyPayment: {\r\n English: \"Monthly Payment\",\r\n Spanish: \"Pago Mensual\",\r\n },\r\n addressInUS: {\r\n English: \"Is the company address in the US?\",\r\n Spanish: \"ยฟLa direcciรณn de la Compaรฑรญa es en los Estados Unidos?\",\r\n },\r\n yes: {\r\n English: \"Yes\",\r\n Spanish: \"Si\",\r\n },\r\n no: {\r\n English: \"No\",\r\n Spanish: \"No\",\r\n },\r\n country: {\r\n English: \"Country\",\r\n Spanish: \"Paรญs\",\r\n },\r\n zipCode: {\r\n English: \"Zip Code\",\r\n Spanish: \"Cรณdigo Postal\",\r\n },\r\n streetAddress: {\r\n English: \"Street Address\",\r\n Spanish: \"Direcciรณn\",\r\n },\r\n apartment: {\r\n English: \"Apartment/Condo/Suite\",\r\n Spanish: \"Apartamento/Condominio/Suite\",\r\n },\r\n city: {\r\n English: \"City\",\r\n Spanish: \"Ciudad\",\r\n },\r\n state: {\r\n English: \"State\",\r\n Spanish: \"Estado\",\r\n },\r\n stateProvince: {\r\n English: \"State/Province\",\r\n Spanish: \"Estado/Provincia\",\r\n },\r\n county: {\r\n English: \"County\",\r\n Spanish: \"Condado\",\r\n },\r\n operatorQuestion: {\r\n English: \"Are you the operator?\",\r\n Spanish: \"ยฟEres el operador?\",\r\n },\r\n operatorFirstName: {\r\n English: \"First Name of Operator\",\r\n Spanish: \"Nombre del Operador\",\r\n },\r\n operatorLastName: {\r\n English: \"Last Name of Operator\",\r\n Spanish: \"Apellido del Operador\",\r\n },\r\n relationshipDescription: {\r\n English: \"Relationship Description\",\r\n Spanish: \"Descripciรณn de la Relaciรณn\",\r\n },\r\n principalQuestion: {\r\n English: \"Are you the principal of the business?\",\r\n Spanish: \"ยฟEres el principal de la Compaรฑรญa?\",\r\n },\r\n principalFirstName: {\r\n English: \"First Name of Principal\",\r\n Spanish: \"Nombre del Principal\",\r\n },\r\n principalLastName: {\r\n English: \"Last Name of Principal\",\r\n Spanish: \"Apellido del Principal\",\r\n },\r\n principalDob: {\r\n English: \"Date of Birth of Principal\",\r\n Spanish: \"Fecha de Nacimiento del Principal\",\r\n },\r\n principalPhoneNumber: {\r\n English: \"Phone Number of Principal\",\r\n Spanish: \"Nรบmero de Telรฉfono del Principal\",\r\n },\r\n principalJobTitle: {\r\n English: \"Principal Job Title\",\r\n Spanish: \"Tรญtulo del Trabajo Principal\",\r\n },\r\n principalOwnership: {\r\n English: \"Principal's Ownership Percentage of the Company\",\r\n Spanish: \"Porcentaje de Propiedad del Principal en la Empresa\",\r\n },\r\n save: {\r\n English: \"Save\",\r\n Spanish: \"Guardar\"\r\n },\r\n\r\n // validation \r\n radioQuestionRequired: {\r\n English: \"Please make a selection.\",\r\n Spanish: \"Por favor, haga una selecciรณn.\",\r\n },\r\n businessTaxIdRequired: {\r\n English: \"Tax ID is required\",\r\n Spanish: \"Se requiere el tax ID\"\r\n },\r\n dbaRequired: {\r\n English: \"Please enter what the name the entity is doing business as.\",\r\n Spanish: \"Por favor, introduzca el nombre bajo el cual opera la entidad.\",\r\n },\r\n addressLine1Required: {\r\n English: \"Address is required.\",\r\n Spanish: \"La direcciรณn es obligatoria.\",\r\n },\r\n cityRequired: {\r\n English: \"City is required.\",\r\n Spanish: \"La ciudad es obligatoria.\",\r\n },\r\n stateRequired: {\r\n English: \"State is required.\",\r\n Spanish: \"El estado es obligatorio.\",\r\n },\r\n zipCodeRequired: {\r\n English: \"Zip Code is required.\",\r\n Spanish: \"El cรณdigo postal es obligatorio.\",\r\n },\r\n invalidZipUS: {\r\n English: \"Zip code is invalid.\",\r\n Spanish: \"El cรณdigo postal es invalido\"\r\n },\r\n countyRequired: {\r\n English: \"County is required.\",\r\n Spanish: \"El condado es obligatorio.\",\r\n },\r\n legalNameRequired: {\r\n English: \"Legal Name is required.\",\r\n Spanish: \"El nombre legal es obligatorio.\",\r\n },\r\n businessStartDateRequired: {\r\n English: \"Business Start Date is required.\",\r\n Spanish: \"La fecha de inicio de la Compaรฑรญa es obligatoria.\",\r\n },\r\n invalidDOBText: {\r\n English: \"Invalid date.\",\r\n Spanish: \"La fecha de nacimento es invalido.\",\r\n },\r\n businessStartDateInvalid: {\r\n English: \"Invalid date format.\",\r\n Spanish: \"Formato de fecha no vรกlido.\",\r\n },\r\n phoneNumberRequired: {\r\n English: \"Phone Number is required.\",\r\n Spanish: \"El nรบmero de telรฉfono es obligatorio.\",\r\n },\r\n invalidPhoneNumberFormat: {\r\n English: \"Phone Number is invalid.\",\r\n Spanish: \"El nรบmero de telรฉfono es invรกlido\"\r\n },\r\n emailRequired: {\r\n English: \"Email Address is required.\",\r\n Spanish: \"La direcciรณn de correo electrรณnico es obligatoria.\",\r\n },\r\n emailInvalid: {\r\n English: \"Must be a valid email address.\",\r\n Spanish: \"Debe ser una direcciรณn de correo electrรณnico vรกlida.\",\r\n },\r\n entityTypeRequired: {\r\n English: \"Entity Type is required.\",\r\n Spanish: \"El tipo de entidad es obligatorio.\",\r\n },\r\n grossMonthlyProfitRequired: {\r\n English: \"Monthly profit is required.\",\r\n Spanish: \"La ganancia mensual es obligatoria.\",\r\n },\r\n principalSameAsApplicantRequired: {\r\n English: \"Please make a selection.\",\r\n Spanish: \"Por favor, haga una selecciรณn.\",\r\n },\r\n firstNameRequired: {\r\n English: \"First name is required.\",\r\n Spanish: \"El nombre es obligatorio.\",\r\n },\r\n lastNameRequired: {\r\n English: \"Last name is required.\",\r\n Spanish: \"El apellido es obligatorio.\",\r\n },\r\n jobTitleRequired: {\r\n English: \"Job title is required.\",\r\n Spanish: \"El tรญtulo del trabajo es obligatorio.\",\r\n },\r\n phoneNumberOperatorRequired: {\r\n English: \"Phone number is required.\",\r\n Spanish: \"El nรบmero de telรฉfono es obligatorio.\",\r\n },\r\n dateOfBirthRequired: {\r\n English: \"Date of birth is required.\",\r\n Spanish: \"La fecha de nacimiento es obligatoria.\",\r\n },\r\n percentageOfOwnershipRequired: {\r\n English: \"Percentage of ownership is required.\",\r\n Spanish: \"El porcentaje de propiedad es obligatorio.\",\r\n },\r\n operatorSameAsApplicantRequired: {\r\n English: \"Please make a selection.\",\r\n Spanish: \"Por favor, haga una selecciรณn.\",\r\n },\r\n firstNameOperatorRequired: {\r\n English: \"First name is required.\",\r\n Spanish: \"El nombre es obligatorio.\",\r\n },\r\n lastNameOperatorRequired: {\r\n English: \"Last name is required.\",\r\n Spanish: \"El apellido es obligatorio.\",\r\n },\r\n relationshipDescriptionOperatorRequired: {\r\n English: \"Relationship type is required.\",\r\n Spanish: \"El tipo de relaciรณn es obligatorio.\",\r\n },\r\n};\r\n\r\nconst customerPortalResidenceStatus = {\r\n paymentRequired: {\r\n English: \"Payment amount is required.\",\r\n Spanish: \"Pago es obligatorio.\",\r\n }\r\n}\r\n\r\nconst generalMessages = {\r\n radioQuestionRequired: {\r\n English: \"Please make a selection.\",\r\n Spanish: \"Por favor, haga una selecciรณn.\",\r\n },\r\n emailInvalid: {\r\n English: \"Must be a valid email address.\",\r\n Spanish: \"Debe ser una direcciรณn de correo electrรณnico vรกlida.\",\r\n },\r\n invalidPhoneNumberFormat: {\r\n English: \"Phone Number is invalid.\",\r\n Spanish: \"El nรบmero de telรฉfono es invรกlido.\"\r\n },\r\n}\r\n\r\nconst LOCALIZATION = {\r\n creditApp,\r\n categories,\r\n buttonLabels,\r\n validations,\r\n miscellaneous,\r\n customerPortalNavBar,\r\n customerPortalHomePage,\r\n customerPortalGaragePage,\r\n customerPortalProfilePage,\r\n customerPortalPersonalInfoSection,\r\n customerPortalHousingInfoSection,\r\n customerPortalEmploymentInfoSection,\r\n customerPortalBusinessSection,\r\n customerPortalBusinessPage,\r\n customerPortalBasicBusinessSection,\r\n customerPortalOperatorBusinessSection,\r\n customerPortalPrincipalBusinessSection,\r\n customerPortalIdentityVerificationPage,\r\n customerPortalAddVehicleForm,\r\n customerPortalAddBusinessForm,\r\n customerPortalResidenceStatus,\r\n generalMessages\r\n}\r\n\r\nexport default LOCALIZATION;","import { helpers, required, requiredIf, } from \"@vuelidate/validators\";\r\nimport LOCALIZATION from \"../Localization\";\r\nimport util from '@core/services/util'\r\n\r\nexport default class ApplicationsResidenceStatus {\r\n constructor(init) {\r\n this.status = null; // Possible Values: mortgage, rental, own, familyOther\r\n this.paymentAmount = null;\r\n this.paymentIncludesInsurance = null;\r\n this.insuranceFrequency = null; // Possible Values: monthly, annually\r\n this.insuranceAmount = null;\r\n this.paymentIncludesTax = null;\r\n this.taxFrequency = null; // Possible Values: monthly, annually\r\n this.taxAmount = null;\r\n this.sharedWith = null; // Possible Values: parent, sibling, other\r\n this.explainStatus = null;\r\n\r\n if (init) {\r\n this.status = init.status;\r\n this.paymentAmount = init.paymentAmount;\r\n this.paymentIncludesInsurance = init.paymentIncludesInsurance;\r\n this.insuranceFrequency = init.insuranceFrequency;\r\n this.insuranceAmount = init.insuranceAmount;\r\n this.paymentIncludesTax = init.paymentIncludesTax;\r\n this.taxFrequency = init.taxFrequency;\r\n this.taxAmount = init.taxAmount;\r\n this.sharedWith = init.sharedWith;\r\n this.explainStatus = init.explainStatus;\r\n }\r\n }\r\n\r\n getStatusProperCase() {\r\n return util.toProperCase(this.status);\r\n }\r\n\r\n validation(language = \"English\") {\r\n const requiredWithMessage = (message) => helpers.withMessage(message, required);\r\n const requiredIfWithMessage = (message, condition) =>\r\n helpers.withMessage(message, requiredIf(condition));\r\n\r\n return {\r\n status: { \r\n required: requiredWithMessage(LOCALIZATION.generalMessages.radioQuestionRequired[language])\r\n },\r\n paymentAmount: { \r\n required: requiredIfWithMessage(\r\n LOCALIZATION.customerPortalResidenceStatus.paymentRequired[language],\r\n () => this.status !== null && this.status !== \"own\"\r\n )\r\n }\r\n };\r\n }\r\n}\r\n\r\n\r\n\r\n\r\n\r\n\r\n","import { helpers, required, requiredIf, } from \"@vuelidate/validators\";\r\nimport ApplicationsResidenceStatus from \"./ApplicationsResidenceStatus\";\r\nimport LOCALIZATION from \"../Localization\";\r\nimport moment from 'moment'\r\nimport { validZIPUS } from \"@core/services/custom-validators\";\r\nexport default class ApplicationsResidence {\r\n constructor(init) {\r\n this.addressLine1 = null;\r\n this.addressLine2 = null;\r\n this.city = null;\r\n this.state = null;\r\n this.zipCode = null;\r\n this.county = null;\r\n this.country = null;\r\n this.outsideUSAddress = null;\r\n this.movedInDate = null;\r\n this.homePhoneNumber = null;\r\n this.usingAddressExtra = null;\r\n this.residenceStatus = new ApplicationsResidenceStatus();\r\n\r\n if (init) {\r\n this.addressLine1 = init.addressLine1;\r\n this.addressLine2 = init.addressLine2;\r\n this.city = init.city;\r\n this.state = init.state;\r\n this.zipCode = init.zipCode;\r\n this.county = init.county;\r\n this.country = init.country;\r\n this.outsideUSAddress = init.outsideUSAddress;\r\n this.movedInDate = init.movedInDate ? moment(init.movedInDate, \"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\").format(\"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\") : init.movedInDate;\r\n this.homePhoneNumber = init.homePhoneNumber;\r\n this.usingAddressExtra = !!init.addressLine2;\r\n this.residenceStatus = new ApplicationsResidenceStatus(init.residenceStatus);\r\n }\r\n\r\n this.usingUSAddress = this.country != null ? (this.country == 'US') : null\r\n }\r\n\r\n getFullAddress() {\r\n let concatenatedAddress = [\r\n this.addressLine1,\r\n this.addressLine2,\r\n this.city,\r\n this.state,\r\n this.zipCode,\r\n this.county,\r\n this.country\r\n ].filter(part => part).join(', ');\r\n\r\n return concatenatedAddress;\r\n }\r\n\r\n getMovedInDateFormatted() {\r\n if (this.movedInDate) {\r\n let movedIn = moment(this.movedInDate, [\"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\", \"MM/DD/YYYY\"]).format(\"MM/DD/YYYY\")\r\n return movedIn;\r\n }\r\n }\r\n\r\n /** When making an update, call the method */\r\n updateUsingUSAddress() {\r\n this.usingUSAddress = this.country !== null ? (this.country === 'US') : null;\r\n }\r\n\r\n validation(includeResidenceStatus = false, language = \"English\") {\r\n const requiredWithMessage = (message) => helpers.withMessage(message, required);\r\n const requiredIfWithMessage = (message, condition) =>\r\n helpers.withMessage(message, requiredIf(condition));\r\n const validWithMessage = (message, validator) =>\r\n helpers.withMessage(message, validator);\r\n\r\n const validationRules = {\r\n usingUSAddress: { required: requiredWithMessage(LOCALIZATION.customerPortalAddBusinessForm.radioQuestionRequired[language]) },\r\n addressLine1: { required: requiredWithMessage(LOCALIZATION.customerPortalAddBusinessForm.addressLine1Required[language]) },\r\n city: { required: requiredWithMessage(LOCALIZATION.customerPortalAddBusinessForm.cityRequired[language]) },\r\n state: { required: requiredWithMessage(LOCALIZATION.customerPortalAddBusinessForm.stateRequired[language]) },\r\n zipCode: { \r\n required: requiredWithMessage(LOCALIZATION.customerPortalAddBusinessForm.zipCodeRequired[language]),\r\n validZIPUS: validWithMessage(\r\n LOCALIZATION.customerPortalAddBusinessForm.invalidZipUS[language], \r\n () => {\r\n if (this.usingUSAddress !== false) {\r\n return validZIPUS(this.zipCode);\r\n }\r\n return true;\r\n }\r\n ),\r\n },\r\n county: { \r\n required: requiredIfWithMessage(\r\n LOCALIZATION.customerPortalAddBusinessForm.countyRequired[language],\r\n () => this.usingUSAddress\r\n )},\r\n };\r\n \r\n if (includeResidenceStatus) {\r\n validationRules.residenceStatus = this.residenceStatus.validation(language);\r\n }\r\n\r\n return validationRules;\r\n }\r\n}\r\n\r\n\r\n\r\n\r\n\r\n\r\n","import { helpers, required, } from \"@vuelidate/validators\";\r\nimport ApplicationsResidence from \"./ApplicationsResidence\";\r\nimport LOCALIZATION from \"../Localization\";\r\nexport default class ApplicationsBusinessOperator {\r\n constructor(init) {\r\n this.operatorSameAsApplicant = null;\r\n this.firstName = null;\r\n this.lastName = null;\r\n this.relationshipDescription = null;\r\n this.address = new ApplicationsResidence();\r\n\r\n if (init) {\r\n this.operatorSameAsApplicant = init.operatorSameAsApplicant;\r\n this.firstName = init.firstName; \r\n this.lastName = init.lastName; \r\n this.relationshipDescription = init.relationshipDescription;\r\n this.address = new ApplicationsResidence(init.address);\r\n }\r\n }\r\n \r\n validation(language = \"English\") {\r\n const requiredWithMessage = (key) =>\r\n helpers.withMessage(LOCALIZATION.customerPortalAddBusinessForm[key][language], required);\r\n\r\n return {\r\n operatorSameAsApplicant: { required: requiredWithMessage(\"operatorSameAsApplicantRequired\") },\r\n firstName: { required: requiredWithMessage(\"firstNameOperatorRequired\") },\r\n lastName: { required: requiredWithMessage(\"lastNameOperatorRequired\"), },\r\n relationshipDescription: { required: requiredWithMessage(\"relationshipDescriptionOperatorRequired\"),},\r\n address: this.address.validation(false, language)\r\n };\r\n }\r\n}\r\n\r\n\r\n\r\n\r\n\r\n\r\n","import { helpers, numeric, required, } from \"@vuelidate/validators\";\r\nimport ApplicationsResidence from \"./ApplicationsResidence\";\r\nimport LOCALIZATION from \"../Localization\";\r\nimport moment from 'moment'\r\nimport { validDateOfBirth } from \"@core/services/custom-validators\";\r\n\r\nexport default class ApplicationsBusinessPrincipal {\r\n constructor(init) {\r\n this.principalSameAsApplicant = null;\r\n this.firstName = null;\r\n this.lastName = null;\r\n this.jobTitle = null;\r\n this.address = new ApplicationsResidence();\r\n this.phoneNumber = null;\r\n this.dateOfBirth = null;\r\n this.percentageOfOwnership = null;\r\n\r\n if (init) {\r\n this.principalSameAsApplicant = init.principalSameAsApplicant;\r\n this.firstName = init.firstName; \r\n this.lastName = init.lastName; \r\n this.jobTitle = init.jobTitle; \r\n this.address = new ApplicationsResidence(init.address); \r\n this.phoneNumber = init.phoneNumber; \r\n this.dateOfBirth = init.dateOfBirth ? moment(init.dateOfBirth, \"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\").format(\"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\") : init.dateOfBirth;\r\n this.percentageOfOwnership = init.percentageOfOwnership; \r\n }\r\n }\r\n\r\n getFullName() {\r\n if (this.firstName && this.lastName) {\r\n return `${this.firstName} ${this.lastName}`;\r\n }\r\n return this.firstName || this.lastName || \"\";\r\n }\r\n\r\n getFormattedDateOfBirth() {\r\n return this.dateOfBirth ? moment(this.dateOfBirth).format(\"MMMM D, YYYY\") : \"\";\r\n }\r\n\r\n getFormattedPercentageOfOwnership() {\r\n return this.percentageOfOwnership != null ? `${this.percentageOfOwnership}%` : \"\";\r\n }\r\n\r\n validation(language = \"English\") {\r\n const requiredWithMessage = (key) =>\r\n helpers.withMessage(LOCALIZATION.customerPortalAddBusinessForm[key][language], required);\r\n\r\n return {\r\n principalSameAsApplicant: { required: requiredWithMessage(\"principalSameAsApplicantRequired\") },\r\n firstName: { required: requiredWithMessage(\"firstNameRequired\") },\r\n lastName: { required: requiredWithMessage(\"lastNameRequired\"), },\r\n jobTitle: { required: requiredWithMessage(\"jobTitleRequired\"), },\r\n phoneNumber: { \r\n numeric,\r\n required: requiredWithMessage(\"phoneNumberRequired\"), \r\n validPhone: helpers.withMessage(\r\n LOCALIZATION.customerPortalAddBusinessForm.invalidPhoneNumberFormat[language],\r\n value => value.length === 10\r\n )\r\n \r\n },\r\n dateOfBirth: { \r\n required: requiredWithMessage(\"dateOfBirthRequired\"),\r\n validDateOfBirth: helpers.withMessage(\r\n LOCALIZATION.customerPortalAddBusinessForm.invalidDOBText[language], \r\n validDateOfBirth\r\n ) \r\n },\r\n percentageOfOwnership: { required: requiredWithMessage(\"percentageOfOwnershipRequired\"),},\r\n address: this.address.validation(false, language)\r\n };\r\n }\r\n}\r\n\r\n\r\n\r\n\r\n\r\n\r\n","import { email, helpers, numeric, required, } from \"@vuelidate/validators\";\r\nimport ApplicationsBusinessOperator from \"./ApplicationsBusinessOperator\";\r\nimport ApplicationsBusinessPrincipal from \"./ApplicationsBusinessPrincipal\";\r\nimport ApplicationsResidence from \"./ApplicationsResidence\";\r\nimport { EntityType } from \"@core/classes/SharedEnums\";\r\nimport LOCALIZATION from \"../Localization\";\r\nimport moment from 'moment'\r\nimport { validBusinessStartDate } from \"@core/services/custom-validators\";\r\n\r\nexport default class ApplicationsBusinessInfo {\r\n constructor(init) {\r\n this.legalName = null;\r\n this.businessStartDate = null;\r\n this.phoneNumber = null;\r\n this.emailAddress = null;\r\n this.businessOperator = new ApplicationsBusinessOperator(); \r\n this.businessPrincipal = new ApplicationsBusinessPrincipal(); \r\n /** Short description of business (ex: fast food restaurant, retail) */\r\n this.businessType = null; \r\n this.yearsInBusiness =null;\r\n this.taxIdHashed = null;\r\n this.taxIdLast4 = null;\r\n \r\n /** Obsolete */\r\n this.address = new ApplicationsResidence(); // Now using a LIST of addresses\r\n this.hasGuarantor = null; // Customer App Specific\r\n this.isApplicantGuarantor = null; // Customer APP specific\r\n this.enterpriseType = null; // Replaced with Entity Type\r\n this.guarantorEstimateCreditScore = null; // Customer App Specific\r\n this.tradeName = null; // Replaced with DBA\r\n this.grossMontlyProfit = null; // Changed Data type, fixed typo\r\n\r\n\r\n /** ---- New properties --- */\r\n\r\n /** new enterprise type. Typescript: entityType: EntityType = EntityType.Unknown;*/\r\n this.entityType = null;\r\n /** List of strings. \"Doing Business As.\" Any 'Aliases' for their Business Name. Typescript: dbas?: string[] = [] */\r\n this.dbas = []; \r\n /** List of company addresses. Company can have addresses in different states, cities, mailing, accounting, etc. */\r\n this.addresses = init?.addresses?.map(address => new ApplicationsResidence(address)) || [];\r\n /** New property for gross monthly profit of the business. Typescript: grossMonthlyProfit?: number = null */\r\n this.grossMonthlyProfit = null;\r\n\r\n\r\n\r\n if (init) {\r\n this.hasGuarantor = init.hasGuarantor;\r\n this.isApplicantGuarantor = init.isApplicantGuarantor;\r\n this.guarantorEstimateCreditScore = init.guarantorEstimateCreditScore;\r\n this.legalName = init.legalName;\r\n this.tradeName = init.tradeName;\r\n this.enterpriseType = init.enterpriseType;\r\n this.taxIdLast4 = init.taxIdLast4;\r\n this.taxIdHashed = init.taxIdHashed;\r\n this.businessStartDate = init.businessStartDate ? moment(init.businessStartDate, \"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\").format(\"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\") : init.businessStartDate;\r\n this.phoneNumber = init.phoneNumber;\r\n this.emailAddress = init.emailAddress;\r\n this.address = new ApplicationsResidence(init.address);\r\n this.businessOperator = new ApplicationsBusinessOperator(init.businessOperator);\r\n this.grossMontlyProfit = init.grossMontlyProfit;\r\n this.businessPrincipal = new ApplicationsBusinessPrincipal(init.businessPrincipal);\r\n this.businessType = init.businessType;\r\n\r\n //calculations\r\n this.yearsInBusiness = init.yearsInBusiness;\r\n\r\n //New Properties\r\n this.entityType = init.entityType;\r\n this.dbas = init.dbas;\r\n this.grossMonthlyProfit = init.grossMonthlyProfit;\r\n if (init?.addresses) {\r\n this.addresses = init.addresses.map(address => new ApplicationsResidence(address));\r\n }\r\n }\r\n }\r\n\r\n validation(includeResidenceStatus = false, language = \"English\") {\r\n const requiredWithMessage = (key) =>\r\n helpers.withMessage(LOCALIZATION.customerPortalAddBusinessForm[key][language], required);\r\n\r\n return {\r\n legalName: { required: requiredWithMessage(\"legalNameRequired\") },\r\n businessStartDate: {\r\n required: requiredWithMessage(\"businessStartDateRequired\"),\r\n validDate: helpers.withMessage(\r\n LOCALIZATION.customerPortalAddBusinessForm.businessStartDateInvalid[language],\r\n validBusinessStartDate\r\n ),\r\n },\r\n phoneNumber: { \r\n numeric: helpers.withMessage(\r\n LOCALIZATION.customerPortalAddBusinessForm.invalidPhoneNumberFormat[language],\r\n numeric\r\n ),\r\n required: requiredWithMessage(\"phoneNumberRequired\"),\r\n validPhone: helpers.withMessage(\r\n LOCALIZATION.customerPortalAddBusinessForm.invalidPhoneNumberFormat[language],\r\n value => value.length === 10\r\n )\r\n },\r\n emailAddress: {\r\n required: requiredWithMessage(\"emailRequired\"),\r\n email: helpers.withMessage(LOCALIZATION.customerPortalAddBusinessForm.emailInvalid[language],\r\n email),\r\n },\r\n entityType: { required: requiredWithMessage(\"entityTypeRequired\"), },\r\n grossMonthlyProfit: { required: requiredWithMessage(\"grossMonthlyProfitRequired\")},\r\n address: this.addresses.map(a => a.validation(includeResidenceStatus, language)),\r\n businessOperator: this.businessOperator.validation(language),\r\n businessPrincipal: this.businessPrincipal.validation(language),\r\n };\r\n }\r\n}\r\n\r\n\r\n\r\n\r\n\r\n\r\n","import moment from 'moment'\r\nimport util from '@core/services/util'\r\n\r\nexport default class ApplicationsEmployment {\r\n constructor(init) {\r\n this.employerName = null;\r\n this.phone = null;\r\n this.position = null;\r\n this.supervisorFirstName = null;\r\n this.supervisorLastName = null;\r\n this.supervisorPhone = null;\r\n this.startDate = null;\r\n this.payType = null; // Possible Values: hourly, salary\r\n this.payAmount = null;\r\n this.getPaidOvertime = null;\r\n this.weeklyHours = null;\r\n this.commissionsAndBonusesAmount = null;\r\n this.commissionsAndBonusesFrequency = null; // Possible Values: weekly, bi-weekly, monthly, annually\r\n this.commissionsAndBonusesDescription = null;\r\n\r\n\r\n if (init) {\r\n this.employerName = init.employerName \r\n this.phone = init.phone\r\n this.position = init.position \r\n this.supervisorFirstName = init.supervisorFirstName\r\n this.supervisorLastName = init.supervisorLastName\r\n this.supervisorPhone = init.supervisorPhone\r\n this.startDate = init.startDate ? moment(init.startDate, \"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\").format(\"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\") : init.startDate;\r\n this.payType = init.payType\r\n this.payAmount = init.payAmount\r\n this.getPaidOvertime = init.getPaidOvertime\r\n this.weeklyHours = init.weeklyHours\r\n this.commissionsAndBonusesAmount = init.commissionsAndBonusesAmount\r\n this.commissionsAndBonusesFrequency = init.commissionsAndBonusesFrequency\r\n this.commissionsAndBonusesDescription = init.commissionsAndBonusesDescription\r\n }\r\n }\r\n\r\n getEmployerPhoneNumberFormatted() {\r\n let phone = util.formatPhoneNumber(this.phone);\r\n return phone;\r\n }\r\n\r\n getEmployerNameProper() {\r\n return util.toProperCase(this.employerName);\r\n }\r\n}\r\n\r\n\r\n\r\n\r\n\r\n\r\n","\r\nexport default class ApplicationsNonEmploymentIncome {\r\n constructor(init) {\r\n this.frequency = null;\r\n this.amount = null;\r\n this.description = null;\r\n\r\n if (init) {\r\n this.frequency = init.frequency;\r\n this.amount = init.amount;\r\n this.description = init.description;\r\n }\r\n }\r\n}\r\n\r\n\r\n\r\n\r\n\r\n\r\n","import moment from 'moment'\r\n\r\nexport default class FIMenuCustomerIdentification {\r\n constructor(init) {\r\n if (init) {\r\n this.type = init.type\r\n this.idNumber = init.idNumber\r\n\r\n if (init.expirationDate) {\r\n this.expirationDate = moment(init.expirationDate, [\"YYYY-MM-DDTHH:mm:ss\", \"MM/DD/YYYY\"]).format(\"MM/DD/YYYY\")\r\n }\r\n else {\r\n this.expirationDate = null;\r\n }\r\n\r\n if (init.issueDate) {\r\n this.issueDate = moment(init.issueDate, [\"YYYY-MM-DDTHH:mm:ss\", \"MM/DD/YYYY\"]).format(\"MM/DD/YYYY\")\r\n }\r\n else {\r\n this.issueDate = null;\r\n }\r\n\r\n this.issuingAgency = init.issuingAgency\r\n this.jurisdiction = init.jurisdiction\r\n\r\n if (init.additionalIdNumbers)\r\n this.additionalIdNumbers = init.additionalIdNumbers;\r\n else\r\n this.additionalIdNumbers = [];\r\n\r\n }\r\n else {\r\n this.type = null\r\n this.idNumber = null\r\n this.issueDate = null\r\n this.expirationDate = null\r\n this.issuingAgency = null\r\n this.jurisdiction = null\r\n this.additionalIdNumbers = [];\r\n }\r\n }\r\n}","import ApplicationsEmployment from \"./ApplicationsEmployment\";\r\nimport ApplicationsNonEmploymentIncome from \"./ApplicationsNonEmploymentIncome\";\r\nimport ApplicationsResidence from \"./ApplicationsResidence\";\r\nimport FIMenuCustomerIdentification from '@core/classes/FIMenuCustomerIdentification'\r\nimport moment from 'moment'\r\nimport util from \"@core/services/util\";\r\n\r\nexport default class ApplicationsPersonalInfo {\r\n constructor(init) {\r\n\r\n this.prefix = null;\r\n this.firstName = null;\r\n this.middleName = null;\r\n this.lastName = null;\r\n this.generationSuffix = null;\r\n this.dateOfBirth = null;\r\n this.phoneNumber = null;\r\n this.emailAddress = null;\r\n this.currentResidence = new ApplicationsResidence();\r\n this.identifications = [];\r\n this.ssnType = null;\r\n this.ssnLast4 = null;\r\n this.ssnHashed = null;\r\n this.estimateCreditScore = null; // Possible Values: poorCredit, fairCredit, goodCredit, veryGoodCredit, excellentCredit, dontKnowCredit\r\n this.previousResidence = new ApplicationsResidence();\r\n this.employmentStatus = null; // Possible Values: employed, retired, disabled, student, unemployed, other\r\n this.nonEmployedStatusStartDate = null;\r\n this.incomeSituationDescription = null;\r\n this.employeeType = null; // Possible Values: w2, 1099, or anything entered by the customer\r\n this.currentEmployment = new ApplicationsEmployment();\r\n this.previousEmployment = new ApplicationsEmployment();\r\n this.socialSecurity = new ApplicationsNonEmploymentIncome();\r\n this.pension = new ApplicationsNonEmploymentIncome();\r\n this.supplementalSecurity = new ApplicationsNonEmploymentIncome();\r\n this.studentSchoolName = null;\r\n this.investment = new ApplicationsNonEmploymentIncome();\r\n this.otherIncome = new ApplicationsNonEmploymentIncome();\r\n this.freezeWithEquifax = null;\r\n this.equifaxPIN = null;\r\n this.freezeWithExperian = null;\r\n this.experianPIN = null;\r\n this.freezeWithTransUnion = null;\r\n this.transUnionPIN = null;\r\n this.lastSuccessfulCreditCheck = null;\r\n this.retirementOrDisabilityStartDate = null;\r\n\r\n //calculations\r\n this.yearsAtAddress = null;\r\n this.monthsAtAddress = null;\r\n this.mortgageRentPayment = null;\r\n this.yearsAtEmployment = null;\r\n this.monthsAtEmployment = null;\r\n this.yearsInNonEmployedStatus = null;\r\n this.monthsInNonEmployedStatus = null;\r\n this.monthlyGrossSalary = null;\r\n this.salaryType = null; //default to always Monthly\r\n\r\n if (init) {\r\n this.prefix = init.prefix;\r\n this.firstName = init.firstName;\r\n this.middleName = init.middleName;\r\n this.lastName = init.lastName;\r\n this.generationSuffix = init.generationSuffix;\r\n this.dateOfBirth = init.dateOfBirth ? moment(init.dateOfBirth, \"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\").format(\"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\") : init.dateOfBirth;\r\n this.phoneNumber = init.phoneNumber;\r\n this.emailAddress = init.emailAddress;\r\n this.currentResidence = new ApplicationsResidence(init.currentResidence);\r\n if (init.identifications && Array.isArray(init.identifications)) {\r\n this.identifications = init.identifications.map(a => new FIMenuCustomerIdentification(a));\r\n }\r\n else {\r\n this.identifications = [];\r\n }\r\n this.ssnType = init.ssnType;\r\n this.ssnLast4 = init.ssnLast4;\r\n this.ssnHashed = init.ssnHashed;\r\n this.estimateCreditScore = init.estimateCreditScore;\r\n this.previousResidence = new ApplicationsResidence(init.previousResidence);\r\n this.employmentStatus = init.employmentStatus;\r\n this.nonEmployedStatusStartDate = init.nonEmployedStatusStartDate ? moment(init.nonEmployedStatusStartDate, \"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\").format(\"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\") : init.nonEmployedStatusStartDate;\r\n this.incomeSituationDescription = init.incomeSituationDescription;\r\n this.employeeType = init.employeeType;\r\n this.currentEmployment = new ApplicationsEmployment(init.currentEmployment);\r\n this.previousEmployment = new ApplicationsEmployment(init.previousEmployment);\r\n this.socialSecurity = new ApplicationsNonEmploymentIncome(init.socialSecurity);\r\n this.pension = new ApplicationsNonEmploymentIncome(init.pension);\r\n this.supplementalSecurity = new ApplicationsNonEmploymentIncome(init.supplementalSecurity);\r\n this.studentSchoolName = init.studentSchoolName;\r\n this.investment = new ApplicationsNonEmploymentIncome(init.investment);\r\n this.otherIncome = new ApplicationsNonEmploymentIncome(init.otherIncome);\r\n this.freezeWithEquifax = init.freezeWithEquifax;\r\n this.equifaxPIN = init.equifaxPIN;\r\n this.freezeWithExperian = init.freezeWithExperian;\r\n this.experianPIN = init.experianPIN;\r\n this.freezeWithTransUnion = init.freezeWithTransUnion;\r\n this.transUnionPIN = init.transUnionPIN;\r\n this.lastSuccessfulCreditCheck = init.lastSuccessfulCreditCheck;\r\n this.retirementOrDisabilityStartDate = init.retirementOrDisabilityStartDate ? moment(init.retirementOrDisabilityStartDate, \"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\").format(\"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\") : init.retirementOrDisabilityStartDate;\r\n\r\n //calculations\r\n this.yearsAtAddress = init.yearsAtAddress;\r\n this.monthsAtAddress = init.monthsAtAddress;\r\n this.mortgageRentPayment = init.mortgageRentPayment;\r\n this.yearsAtEmployment = init.yearsAtEmployment;\r\n this.monthsAtEmployment = init.monthsAtEmployment;\r\n this.yearsInNonEmployedStatus = init.yearsInNonEmployedStatus;\r\n this.monthsInNonEmployedStatus = init.monthsInNonEmployedStatus;\r\n this.monthlyGrossSalary = init.monthlyGrossSalary;\r\n this.salaryType = init.salaryType;\r\n }\r\n }\r\n\r\n getFullName() {\r\n const concatenatedName = [\r\n this.prefix,\r\n this.firstName,\r\n this.middleName,\r\n this.lastName,\r\n this.suffix\r\n ].filter(part => part).join(' ');\r\n return util.toProperCase(concatenatedName);\r\n }\r\n\r\n getDateOfBirthFormatted() {\r\n if (this.dateOfBirth) {\r\n const dob = moment(this.dateOfBirth, [\"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\", \"MM/DD/YYYY\"]).format(\"MM/DD/YYYY\")\r\n return dob;\r\n }\r\n }\r\n\r\n getPhoneNumberFormatted() {\r\n const phone = util.formatPhoneNumber(this.phoneNumber);\r\n return phone;\r\n }\r\n\r\n getEmploymentStatusProperCase() {\r\n return util.toProperCase(this.employmentStatus)\r\n }\r\n\r\n getSalaryTypeProper() {\r\n return util.toProperCase(this.salaryType)\r\n }\r\n\r\n getTimeAtEmployment() {\r\n return `${this.yearsAtEmployment} years, ${this.monthsAtEmployment} months`\r\n }\r\n\r\n getTimeAtNonEmployed() {\r\n return `${this.yearsInNonEmployedStatus} years, ${this.monthsInNonEmployedStatus} months`;\r\n }\r\n\r\n getEmploymentStatusStartDateFormatted() {\r\n if (this.nonEmployedStatusStartDate) {\r\n let movedIn = moment(this.nonEmployedStatusStartDate, ['YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]', 'MM/DD/YYYY']).format('MM/DD/YYYY');\r\n return movedIn;\r\n }\r\n else if (this.currentEmployment.startDate) {\r\n let movedIn = moment(this.currentEmployment.startDate, ['YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]', 'MM/DD/YYYY']).format('MM/DD/YYYY');\r\n return movedIn;\r\n }\r\n }\r\n\r\n getGrossSalaryDescription() {\r\n const grossSalaryDescription = []\r\n if (this.employmentStatus != null) {\r\n //Employed Income\r\n if (this.employmentStatus == 'employed') {\r\n if (this.currentEmployment?.payAmount) {\r\n if (this.currentEmployment.payType == 'salary') {\r\n grossSalaryDescription.push(\r\n 'Employment Salary: $' + (this.currentEmployment.payAmount / 12).toFixed(2)\r\n )\r\n } else {\r\n if (\r\n this.currentEmployment.getPaidOvertime == true &&\r\n this.currentEmployment.weeklyHours > 40\r\n ) {\r\n var overtime =\r\n (this.currentEmployment.weeklyHours - 40) *\r\n (this.currentEmployment.payAmount * 1.5)\r\n grossSalaryDescription.push(\r\n 'Employment Salary: $' +\r\n (\r\n ((this.currentEmployment.payAmount * 40 + overtime) * 52) /\r\n 12\r\n ).toFixed(2)\r\n )\r\n } else {\r\n grossSalaryDescription.push(\r\n 'Employment Salary: $' +\r\n (\r\n (this.currentEmployment.payAmount *\r\n this.currentEmployment.weeklyHours *\r\n 52) /\r\n 12\r\n ).toFixed(2)\r\n )\r\n }\r\n }\r\n }\r\n\r\n //Add CommissionsOrBonuses\r\n if (this.currentEmployment.commissionsAndBonusesFrequency != null) {\r\n grossSalaryDescription.push(\r\n 'Commissions/Bonuses Income: $' +\r\n this.util\r\n .calculateMonthlyIncome(\r\n this.currentEmployment.commissionsAndBonusesFrequency,\r\n this.currentEmployment.commissionsAndBonusesAmount\r\n )\r\n .toFixed(2)\r\n )\r\n }\r\n }\r\n //Retired Income\r\n else if (this.employmentStatus == 'retired' && this.socialSecurity != null) {\r\n const calculatedIncome = this.util.calculateMonthlyIncome(\r\n this.socialSecurity.frequency,\r\n this.socialSecurity.amount\r\n );\r\n\r\n grossSalaryDescription.push(\r\n 'Retirement Income: $' +\r\n (calculatedIncome ? calculatedIncome.toFixed(2) : 0)\r\n )\r\n }\r\n //Disabled Income\r\n else if (this.employmentStatus == 'disabled' && this.supplementalSecurity != null) {\r\n const calculatedIncome = this.util.calculateMonthlyIncome(\r\n this.supplementalSecurity.frequency,\r\n this.supplementalSecurity.amount\r\n );\r\n\r\n grossSalaryDescription.push(\r\n 'Supplemental Security Income: $' +\r\n (calculatedIncome ? calculatedIncome.toFixed(2) : 0)\r\n )\r\n }\r\n }\r\n\r\n //Add Pension\r\n if (this.pension?.frequency != null) {\r\n grossSalaryDescription.push(\r\n 'Pension Income: $' +\r\n this.util\r\n .calculateMonthlyIncome(this.pension.frequency, this.pension.amount)\r\n .toFixed(2)\r\n )\r\n }\r\n\r\n //Add Investments\r\n if (this.investment?.frequency != null) {\r\n grossSalaryDescription.push(\r\n 'Investments Income: $' +\r\n this.util\r\n .calculateMonthlyIncome(\r\n this.investment.frequency,\r\n this.investment.amount\r\n )\r\n .toFixed(2)\r\n )\r\n }\r\n\r\n //Add Other Income\r\n if (this.otherIncome?.frequency != null) {\r\n grossSalaryDescription.push(\r\n 'Other Income: $' +\r\n this.util\r\n .calculateMonthlyIncome(\r\n this.otherIncome.frequency,\r\n this.otherIncome.amount\r\n )\r\n .toFixed(2)\r\n )\r\n }\r\n\r\n return grossSalaryDescription\r\n }\r\n\r\n getMonthlyGrossSalaryProper() {\r\n const formatted = util.formatPrice(this.monthlyGrossSalary);\r\n return formatted;\r\n }\r\n}\r\n","\r\nexport default class ApplicationsRebates {\r\n constructor(init) {\r\n this.rebateCurrentVehicles = {\r\n numberOfVehicles: null, // Possible Values: 0, 1, 2, 3, null\r\n vehicles: []\r\n }\r\n this.rebateReturnedLeaseVehicles = {\r\n numberOfVehicles: null, // Possible Values: 0, 1, 2, 3, null\r\n vehicles: []\r\n }\r\n this.rebateMilitary = {\r\n whoIsMilitary: null, // Possible Values: me, spouse, both, noOne\r\n militaryBranchSelf: null, // Possible Values: army, navy, airForce, nationalGuard, marines, coastGuard\r\n militaryStatusSelf: null, // Possible Values: active, veteran, inactive, retired, reservist\r\n enrollmentDateSelf: null,\r\n militaryBranchSpouse: null, // Possible Values: army, navy, airForce, nationalGuard, marines, coastGuard\r\n militaryStatusSpouse: null, // Possible Values: active, veteran, inactive, retired, reservist\r\n enrollmentDateSpouse: null\r\n };\r\n this.rebateAcademic = {\r\n isEnrolled: null,\r\n academicSchoolName: null,\r\n academicStudentType: null, // Possible Values: fullTime, partTime, graduated, academicLeave\r\n academicInstitutionType: null, // Possible Values: highSchool, college, university, tradeSchool, registeredNursingSchool, nursingSchool\r\n enrollmentDate: null\r\n };\r\n this.rebateOrganizations = null; //List Possible Values: nar, ffa, fba, dfa, nari, nfib, nfda (can be empty) \r\n\r\n if (init) {\r\n if (init.rebateCurrentVehicles) {\r\n this.rebateCurrentVehicles = init.rebateCurrentVehicles;\r\n }\r\n\r\n if (init.rebateReturnedLeaseVehicles) {\r\n this.rebateReturnedLeaseVehicles = init.rebateReturnedLeaseVehicles;\r\n }\r\n\r\n if (init.rebateMilitary) {\r\n this.rebateMilitary = init.rebateMilitary;\r\n }\r\n\r\n if (init.rebateAcademic) {\r\n this.rebateAcademic = init.rebateAcademic;\r\n }\r\n\r\n if (init.rebateOrganizations) {\r\n this.rebateOrganizations = init.rebateOrganizations;\r\n }\r\n }\r\n }\r\n}\r\n\r\n\r\n\r\n\r\n\r\n\r\n","import ApplicationsBusinessInfo from \"./ApplicationsBusinessInfo\";\r\nimport ApplicationsPersonalInfo from \"./ApplicationsPersonalInfo\";\r\nimport ApplicationsRebates from \"./ApplicationsRebates\";\r\nimport ApplicationsResidence from \"./ApplicationsResidence\";\r\n\r\nexport default class ApplicationsDataAnswered {\r\n constructor(init) {\r\n\r\n //FROM QUOTE\r\n this.dealTypes = []; // Possible Values: cash, finance, lease\r\n this.requestedInaccurateQuote = null\r\n this.garagedAddressOutsideUS = null;\r\n this.garagedAddressSameAsResidence = null;\r\n this.garagedAddress = new ApplicationsResidence();\r\n this.personalInfo = new ApplicationsPersonalInfo({});\r\n this.rebates = new ApplicationsRebates({});\r\n this.isBusiness = null;\r\n this.businessInfo = new ApplicationsBusinessInfo();\r\n\r\n if (init) {\r\n //FROM QUOTE\r\n this.dealTypes = init.dealTypes;\r\n this.requestedInaccurateQuote = init.requestedInaccurateQuote\r\n this.garagedAddressOutsideUS = init.garagedAddressOutsideUS;\r\n this.garagedAddressSameAsResidence = init.garagedAddressSameAsResidence;\r\n this.garagedAddress = new ApplicationsResidence(init.garagedAddress);\r\n this.personalInfo = new ApplicationsPersonalInfo(init.personalInfo);\r\n this.rebates = new ApplicationsRebates(init.rebates);\r\n this.isBusiness = init.isBusiness;\r\n this.businessInfo = new ApplicationsBusinessInfo(init.businessInfo);\r\n }\r\n }\r\n}\r\n\r\n\r\n\r\n\r\n\r\n\r\n","export default class Maps {\r\n constructor() {\r\n this.placesService = new window.google.maps.places.PlacesService(document.createElement('div'));\r\n this.autocompleteService = new window.google.maps.places.AutocompleteService();\r\n this.results = [];\r\n }\r\n\r\n async searchAddresses(input, firstObject = null, additionalData = null) {\r\n\r\n let placePredictionsReqObj = {\r\n input: input,\r\n types: ['address'],\r\n fields: ['name', 'place_id'],\r\n componentRestrictions: { country: 'us' }\r\n }\r\n\r\n console.log('additionalData', additionalData);\r\n\r\n //ADDITIONAL DATA TO GIVE PRIORITY TO SOME LAT/LNG LOCATION\r\n if (additionalData && additionalData.lat && additionalData.lng) {\r\n placePredictionsReqObj.location = new window.google.maps.LatLng(additionalData.lat, additionalData.lng)\r\n placePredictionsReqObj.radius = 1\r\n }\r\n\r\n await this.autocompleteService.getPlacePredictions(placePredictionsReqObj, (response) => {\r\n console.log('autocompleteService response', response);\r\n if (response) {\r\n this.results = response;\r\n } else {\r\n if (firstObject) {\r\n this.results = [firstObject];\r\n } else {\r\n this.results = [];\r\n }\r\n }\r\n\r\n });\r\n\r\n }\r\n\r\n async getAddressDetails(suggestionResult, callback) {\r\n\r\n let detailsRequest = {\r\n placeId: suggestionResult.place_id,\r\n fields: ['address_components']\r\n };\r\n\r\n await this.placesService.getDetails(detailsRequest, (details) => {\r\n\r\n console.log('maps getAddressDetails', details);\r\n\r\n let finalDetails = {\r\n address1: null,\r\n address2: null,\r\n city: null,\r\n state: null,\r\n zip: null,\r\n county: null\r\n }\r\n\r\n if (details && details.address_components) {\r\n\r\n let addrInfo = details.address_components;\r\n let parsedDetails = {\r\n streetNumber: addrInfo.find(i => i.types.includes('street_number')),\r\n streetAddress: addrInfo.find(i => i.types.includes('street_address')),\r\n room: addrInfo.find(i => i.types.includes('room')),\r\n locality: addrInfo.find(i => i.types.includes('locality')),\r\n sublocality: addrInfo.find(i => i.types.includes('sublocality')),\r\n route: addrInfo.find(i => i.types.includes('route')),\r\n state: addrInfo.find(i => i.types.includes('administrative_area_level_1')),\r\n county: addrInfo.find(i => i.types.includes('administrative_area_level_2')),\r\n administrative_area_level_3: addrInfo.find(i => i.types.includes('administrative_area_level_3')),\r\n administrative_area_level_4: addrInfo.find(i => i.types.includes('administrative_area_level_4')),\r\n administrative_area_level_5: addrInfo.find(i => i.types.includes('administrative_area_level_5')),\r\n administrative_area_level_6: addrInfo.find(i => i.types.includes('administrative_area_level_6')),\r\n administrative_area_level_7: addrInfo.find(i => i.types.includes('administrative_area_level_7')),\r\n zip: addrInfo.find(i => i.types.includes('postal_code')),\r\n }\r\n\r\n\r\n\r\n //ADDRESS1\r\n if (parsedDetails.streetAddress) {\r\n finalDetails.address1 = parsedDetails.streetAddress.short_name ?? parsedDetails.streetAddress.long_name;\r\n }\r\n else if (parsedDetails.streetNumber && parsedDetails.route) {\r\n finalDetails.address1 = `${parsedDetails.streetNumber.short_name} ${parsedDetails.route.short_name}`;\r\n }\r\n else if (parsedDetails.route) {\r\n finalDetails.address1 = parsedDetails.route.short_name;\r\n }\r\n\r\n //ADDRESS2\r\n if (parsedDetails.room) {\r\n finalDetails.address2 = parsedDetails.room.long_name;\r\n }\r\n\r\n //CITY\r\n if (parsedDetails.locality) {\r\n finalDetails.city = parsedDetails.locality.long_name;\r\n }\r\n else if (parsedDetails.sublocality) {\r\n finalDetails.city = parsedDetails.sublocality.long_name;\r\n }\r\n else if (parsedDetails.administrative_area_level_3) {\r\n finalDetails.city = parsedDetails.administrative_area_level_3.long_name;\r\n }\r\n else if (parsedDetails.administrative_area_level_4) {\r\n finalDetails.city = parsedDetails.administrative_area_level_4.long_name;\r\n }\r\n else if (parsedDetails.administrative_area_level_5) {\r\n finalDetails.city = parsedDetails.administrative_area_level_5.long_name;\r\n }\r\n else if (parsedDetails.administrative_area_level_6) {\r\n finalDetails.city = parsedDetails.administrative_area_level_6.long_name;\r\n }\r\n else if (parsedDetails.administrative_area_level_7) {\r\n finalDetails.city = parsedDetails.administrative_area_level_7.long_name;\r\n }\r\n\r\n //STATE\r\n if (parsedDetails.state) {\r\n finalDetails.state = parsedDetails.state.short_name;\r\n }\r\n\r\n //ZIP\r\n if (parsedDetails.zip) {\r\n finalDetails.zip = parsedDetails.zip.short_name;\r\n }\r\n\r\n //COUNTY\r\n if (parsedDetails.county) {\r\n finalDetails.county = parsedDetails.county.long_name;\r\n }\r\n\r\n }\r\n //console.log('finalDetails', finalDetails);\r\n callback(finalDetails);\r\n\r\n });\r\n }\r\n\r\n clearResults() {\r\n this.results = [];\r\n }\r\n}\r\n","\r\n\r\n\r\n\r\n","\r\n\r\n\r\n\r\n","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse {\n\t\tvar a = factory();\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(this, function() {\nreturn /******/ (function() { // webpackBootstrap\n/******/ \tvar __webpack_modules__ = ({\n\n/***/ \"./packages/@logrocket/console/src/index.js\":\n/*!**************************************************!*\\\n !*** ./packages/@logrocket/console/src/index.js ***!\n \\**************************************************/\n/***/ (function(__unused_webpack_module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ \"./node_modules/@babel/runtime/helpers/interopRequireDefault.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\nvar _registerConsole = _interopRequireDefault(__webpack_require__(/*! ./registerConsole */ \"./packages/@logrocket/console/src/registerConsole.js\"));\nvar _default = _registerConsole.default;\nexports[\"default\"] = _default;\n\n/***/ }),\n\n/***/ \"./packages/@logrocket/console/src/registerConsole.js\":\n/*!************************************************************!*\\\n !*** ./packages/@logrocket/console/src/registerConsole.js ***!\n \\************************************************************/\n/***/ (function(__unused_webpack_module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ \"./node_modules/@babel/runtime/helpers/interopRequireDefault.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = registerConsole;\nvar _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ \"./node_modules/@babel/runtime/helpers/typeof.js\"));\nvar _enhanceFunc = _interopRequireDefault(__webpack_require__(/*! @logrocket/utils/src/enhanceFunc */ \"./packages/@logrocket/utils/src/enhanceFunc.ts\"));\nvar _exceptions = __webpack_require__(/*! @logrocket/exceptions */ \"./packages/@logrocket/exceptions/src/index.js\");\n// eslint-disable-line no-restricted-imports\n\nfunction registerConsole(logger) {\n var unsubFunctions = [];\n var methods = ['log', 'warn', 'info', 'error', 'debug'];\n methods.forEach(function (method) {\n unsubFunctions.push((0, _enhanceFunc.default)(console, method, function () {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n logger.addEvent('lr.core.LogEvent', function () {\n var consoleOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var isEnabled = consoleOptions.isEnabled;\n if ((0, _typeof2.default)(isEnabled) === 'object' && isEnabled[method] === false || isEnabled === false) {\n return null;\n }\n if (method === 'error' && consoleOptions.shouldAggregateConsoleErrors) {\n _exceptions.Capture.captureMessage(logger, args[0], args, {}, true);\n }\n return {\n logLevel: method.toUpperCase(),\n args: args\n };\n });\n }));\n });\n return function () {\n unsubFunctions.forEach(function (unsubFunction) {\n return unsubFunction();\n });\n };\n}\n\n/***/ }),\n\n/***/ \"./packages/@logrocket/exceptions/src/Capture.js\":\n/*!*******************************************************!*\\\n !*** ./packages/@logrocket/exceptions/src/Capture.js ***!\n \\*******************************************************/\n/***/ (function(__unused_webpack_module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ \"./node_modules/@babel/runtime/helpers/interopRequireDefault.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports.captureMessage = captureMessage;\nexports.captureException = captureException;\nvar _scrubException = __webpack_require__(/*! @logrocket/utils/src/scrubException */ \"./packages/@logrocket/utils/src/scrubException.ts\");\nvar _TraceKit = _interopRequireDefault(__webpack_require__(/*! @logrocket/utils/src/TraceKit */ \"./packages/@logrocket/utils/src/TraceKit.js\"));\nvar _stackTraceFromError = _interopRequireDefault(__webpack_require__(/*! ./stackTraceFromError */ \"./packages/@logrocket/exceptions/src/stackTraceFromError.js\"));\n// eslint-disable-line no-restricted-imports\n// eslint-disable-line no-restricted-imports\n\nfunction captureMessage(logger, message, messageArgs) {\n var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};\n var isConsole = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;\n var data = {\n exceptionType: isConsole ? 'CONSOLE' : 'MESSAGE',\n message: message,\n messageArgs: messageArgs,\n browserHref: window.location ? window.location.href : ''\n };\n (0, _scrubException.scrubException)(data, options);\n logger.addEvent('lr.core.Exception', function () {\n return data;\n });\n}\nfunction captureException(logger, exception) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var preppedTrace = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;\n var exceptionType = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'WINDOW';\n var trace = preppedTrace || _TraceKit.default.computeStackTrace(exception);\n var data = {\n exceptionType: exceptionType,\n errorType: trace.name,\n message: trace.message,\n browserHref: window.location ? window.location.href : ''\n };\n (0, _scrubException.scrubException)(data, options);\n var addEventOptions = {\n _stackTrace: (0, _stackTraceFromError.default)(trace)\n };\n logger.addEvent('lr.core.Exception', function () {\n return data;\n }, addEventOptions);\n}\n\n/***/ }),\n\n/***/ \"./packages/@logrocket/exceptions/src/index.js\":\n/*!*****************************************************!*\\\n !*** ./packages/@logrocket/exceptions/src/index.js ***!\n \\*****************************************************/\n/***/ (function(__unused_webpack_module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ \"./node_modules/@babel/runtime/helpers/interopRequireDefault.js\");\nvar _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ \"./node_modules/@babel/runtime/helpers/typeof.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nObject.defineProperty(exports, \"registerExceptions\", ({\n enumerable: true,\n get: function get() {\n return _registerExceptions.default;\n }\n}));\nexports.Capture = void 0;\nvar _registerExceptions = _interopRequireDefault(__webpack_require__(/*! ./registerExceptions */ \"./packages/@logrocket/exceptions/src/registerExceptions.js\"));\nvar Capture = _interopRequireWildcard(__webpack_require__(/*! ./Capture */ \"./packages/@logrocket/exceptions/src/Capture.js\"));\nexports.Capture = Capture;\nfunction _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== \"function\") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }\nfunction _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== \"object\" && typeof obj !== \"function\") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== \"default\" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }\n\n/***/ }),\n\n/***/ \"./packages/@logrocket/exceptions/src/raven/raven.js\":\n/*!***********************************************************!*\\\n !*** ./packages/@logrocket/exceptions/src/raven/raven.js ***!\n \\***********************************************************/\n/***/ (function(__unused_webpack_module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ \"./node_modules/@babel/runtime/helpers/interopRequireDefault.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\nvar _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ \"./node_modules/@babel/runtime/helpers/classCallCheck.js\"));\nvar _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ \"./node_modules/@babel/runtime/helpers/createClass.js\"));\nvar _TraceKit = _interopRequireDefault(__webpack_require__(/*! @logrocket/utils/src/TraceKit */ \"./packages/@logrocket/utils/src/TraceKit.js\"));\n/* eslint-disable */\n\n/*\nSome contents of this file were originaly from raven-js, BSD-2 Clause\n\nCopyright (c) 2018 Sentry (https://sentry.io) and individual contributors.\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\n\n* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\n* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n*/\n\nvar objectPrototype = Object.prototype;\nfunction isUndefined(what) {\n return what === void 0;\n}\nfunction isFunction(what) {\n return typeof what === 'function';\n}\nfunction each(obj, callback) {\n var i, j;\n if (isUndefined(obj.length)) {\n for (i in obj) {\n if (hasKey(obj, i)) {\n callback.call(null, i, obj[i]);\n }\n }\n } else {\n j = obj.length;\n if (j) {\n for (i = 0; i < j; i++) {\n callback.call(null, i, obj[i]);\n }\n }\n }\n}\n\n/**\n * hasKey, a better form of hasOwnProperty\n * Example: hasKey(MainHostObject, property) === true/false\n *\n * @param {Object} host object to check property\n * @param {string} key to check\n */\nfunction hasKey(object, key) {\n return objectPrototype.hasOwnProperty.call(object, key);\n}\n\n/**\n * Polyfill a method\n * @param obj object e.g. `document`\n * @param name method name present on object e.g. `addEventListener`\n * @param replacement replacement function\n * @param track {optional} record instrumentation to an array\n */\nfunction fill(obj, name, replacement, track) {\n var orig = obj[name];\n obj[name] = replacement(orig);\n if (track) {\n track.push([obj, name, orig]);\n }\n}\nvar _window = typeof window !== 'undefined' ? window : typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g : typeof self !== 'undefined' ? self : {};\nvar _document = _window.document;\nvar Handler = /*#__PURE__*/function () {\n function Handler(_ref) {\n var captureException = _ref.captureException;\n (0, _classCallCheck2.default)(this, Handler);\n this._errorHandler = this._errorHandler.bind(this);\n this._ignoreOnError = 0;\n this._wrappedBuiltIns = [];\n this.captureException = captureException;\n _TraceKit.default.report.subscribe(this._errorHandler);\n this._instrumentTryCatch();\n }\n (0, _createClass2.default)(Handler, [{\n key: \"uninstall\",\n value: function uninstall() {\n _TraceKit.default.report.unsubscribe(this._errorHandler);\n\n // restore any wrapped builtins\n var builtin;\n while (this._wrappedBuiltIns.length) {\n builtin = this._wrappedBuiltIns.shift();\n var obj = builtin[0],\n name = builtin[1],\n orig = builtin[2];\n obj[name] = orig;\n }\n }\n }, {\n key: \"_errorHandler\",\n value: function _errorHandler(report) {\n if (!this._ignoreOnError) {\n this.captureException(report);\n }\n }\n }, {\n key: \"_ignoreNextOnError\",\n value: function _ignoreNextOnError() {\n var _this = this;\n this._ignoreOnError += 1;\n setTimeout(function () {\n // onerror should trigger before setTimeout\n _this._ignoreOnError -= 1;\n });\n }\n\n /*\n * Wrap code within a context so Handler can capture errors\n * reliably across domains that is executed immediately.\n *\n * @param {object} options A specific set of options for this context [optional]\n * @param {function} func The callback to be immediately executed within the context\n * @param {array} args An array of arguments to be called with the callback [optional]\n */\n }, {\n key: \"context\",\n value: function context(options, func, args) {\n if (isFunction(options)) {\n args = func || [];\n func = options;\n options = undefined;\n }\n return this.wrap(options, func).apply(this, args);\n }\n }, {\n key: \"wrap\",\n value:\n /*\n * Wrap code within a context and returns back a new function to be executed\n *\n * @param {object} options A specific set of options for this context [optional]\n * @param {function} func The function to be wrapped in a new context\n * @param {function} func A function to call before the try/catch wrapper [optional, private]\n * @return {function} The newly wrapped functions with a context\n */\n function wrap(options, func, _before) {\n var self = this;\n // 1 argument has been passed, and it's not a function\n // so just return it\n if (isUndefined(func) && !isFunction(options)) {\n return options;\n }\n\n // options is optional\n if (isFunction(options)) {\n func = options;\n options = undefined;\n }\n\n // At this point, we've passed along 2 arguments, and the second one\n // is not a function either, so we'll just return the second argument.\n if (!isFunction(func)) {\n return func;\n }\n\n // We don't wanna wrap it twice!\n try {\n if (func.__lr__) {\n return func;\n }\n\n // If this has already been wrapped in the past, return that\n if (func.__lr_wrapper__) {\n return func.__lr_wrapper__;\n }\n\n // If func is not extensible, return the function as-is to prevent TypeErrors\n // when trying to add new props & to assure immutable funcs aren't changed\n if (!Object.isExtensible(func)) {\n return func;\n }\n } catch (e) {\n // Just accessing custom props in some Selenium environments\n // can cause a \"Permission denied\" exception (see lr-js#495).\n // Bail on wrapping and return the function as-is (defers to window.onerror).\n return func;\n }\n function wrapped() {\n var args = [],\n i = arguments.length,\n deep = !options || options && options.deep !== false;\n if (_before && isFunction(_before)) {\n _before.apply(this, arguments);\n }\n\n // Recursively wrap all of a function's arguments that are\n // functions themselves.\n while (i--) {\n args[i] = deep ? self.wrap(options, arguments[i]) : arguments[i];\n }\n try {\n // Attempt to invoke user-land function. This is part of the LogRocket SDK.\n // If you're seeing this frame in a stack trace, it means that LogRocket caught\n // an unhandled error thrown by your application code, reported it, then bubbled\n // it up. This is expected behavior and is not a bug with LogRocket.\n return func.apply(this, args);\n } catch (e) {\n self._ignoreNextOnError();\n self.captureException(_TraceKit.default.computeStackTrace(e), options);\n throw e;\n }\n }\n\n // copy over properties of the old function\n for (var property in func) {\n if (hasKey(func, property)) {\n wrapped[property] = func[property];\n }\n }\n wrapped.prototype = func.prototype;\n func.__lr_wrapper__ = wrapped;\n // Signal that this function has been wrapped already\n // for both debugging and to prevent it to being wrapped twice\n wrapped.__lr__ = true;\n wrapped.__inner__ = func;\n return wrapped;\n }\n }, {\n key: \"_instrumentTryCatch\",\n value:\n /**\n * Install any queued plugins\n */\n function _instrumentTryCatch() {\n var self = this;\n var wrappedBuiltIns = self._wrappedBuiltIns;\n function wrapTimeFn(orig) {\n return function (fn, t) {\n // preserve arity\n // Make a copy of the arguments to prevent deoptimization\n // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments\n var args = new Array(arguments.length);\n for (var i = 0; i < args.length; ++i) {\n args[i] = arguments[i];\n }\n var originalCallback = args[0];\n if (isFunction(originalCallback)) {\n args[0] = self.wrap(originalCallback);\n }\n\n // IE < 9 doesn't support .call/.apply on setInterval/setTimeout, but it\n // also supports only two arguments and doesn't care what this is, so we\n // can just call the original function directly.\n if (orig.apply) {\n return orig.apply(this, args);\n } else {\n return orig(args[0], args[1]);\n }\n };\n }\n function wrapEventTarget(global) {\n var proto = _window[global] && _window[global].prototype;\n if (proto && proto.hasOwnProperty && proto.hasOwnProperty('addEventListener')) {\n fill(proto, 'addEventListener', function (orig) {\n return function (evtName, fn, capture, secure) {\n // preserve arity\n try {\n if (fn && fn.handleEvent) {\n fn.handleEvent = self.wrap(fn.handleEvent);\n }\n } catch (err) {\n // can sometimes get 'Permission denied to access property \"handle Event'\n }\n\n // More breadcrumb DOM capture ... done here and not in `_instrumentBreadcrumbs`\n // so that we don't have more than one wrapper function\n var before;\n return orig.call(this, evtName, self.wrap(fn, undefined, before), capture, secure);\n };\n }, wrappedBuiltIns);\n fill(proto, 'removeEventListener', function (orig) {\n return function (evt, fn, capture, secure) {\n /**\n * There are 3 scenararios to consider when removing an event listener\n *\n * 1. 'addEventListener' was called when the LR SDK was uninitialized.\n * In this case, the event handler has not been wrapped, so this behaves \n * as a passthrough and just removes the original handler.\n *\n * 2. 'addEventListener' was called while the LR SDK was initialized, which means\n * our wrapped 'addEventListener' was called. In this case, the tracked event handler\n * is also wrapped, so we need to remove that wrapped version of the handler.\n *\n * 3. 'addEventListener' was called both before and after the LR SDK was initialized\n * for the same event handler. In this case, we have to remove both of them.\n * If we'd remove only the wrapped one, the initial handler would stick around forever.\n */\n try {\n var wrappedFn = fn === null || fn === void 0 ? void 0 : fn.__lr_wrapper__;\n if (wrappedFn) {\n orig.call(this, evt, wrappedFn, capture, secure);\n }\n } catch (e) {\n // ignore, accessing __lr_wrapper__ will throw in some Selenium environments\n }\n return orig.call(this, evt, fn, capture, secure);\n };\n },\n // undefined is provided here to skip tracking for uninstall.\n // Once our removeEventListener is installed, it can't be uninstalled.\n // We always need to support removing logrocket wrapped event handlers (event\n // handlers added when logrocket was installed) even after SDK shutdown.\n undefined);\n }\n }\n fill(_window, 'setTimeout', wrapTimeFn, wrappedBuiltIns);\n fill(_window, 'setInterval', wrapTimeFn, wrappedBuiltIns);\n if (_window.requestAnimationFrame) {\n fill(_window, 'requestAnimationFrame', function (orig) {\n return function (cb) {\n return orig(self.wrap(cb));\n };\n }, wrappedBuiltIns);\n }\n\n // event targets borrowed from bugsnag-js:\n // https://github.com/bugsnag/bugsnag-js/blob/master/src/bugsnag.js#L666\n var eventTargets = ['EventTarget', 'Window', 'Node', 'ApplicationCache', 'AudioTrackList', 'ChannelMergerNode', 'CryptoOperation', 'EventSource', 'FileReader', 'HTMLUnknownElement', 'IDBDatabase', 'IDBRequest', 'IDBTransaction', 'KeyOperation', 'MediaController', 'MessagePort', 'ModalWindow', 'Notification', 'SVGElementInstance', 'Screen', 'TextTrack', 'TextTrackCue', 'TextTrackList', 'WebSocket', 'WebSocketWorker', 'Worker', 'XMLHttpRequest', 'XMLHttpRequestEventTarget', 'XMLHttpRequestUpload'];\n for (var i = 0; i < eventTargets.length; i++) {\n wrapEventTarget(eventTargets[i]);\n }\n var $ = _window.jQuery || _window.$;\n if ($ && $.fn && $.fn.ready) {\n fill($.fn, 'ready', function (orig) {\n return function (fn) {\n return orig.call(this, self.wrap(fn));\n };\n }, wrappedBuiltIns);\n }\n }\n }]);\n return Handler;\n}();\nexports[\"default\"] = Handler;\n;\n\n/***/ }),\n\n/***/ \"./packages/@logrocket/exceptions/src/registerExceptions.js\":\n/*!******************************************************************!*\\\n !*** ./packages/@logrocket/exceptions/src/registerExceptions.js ***!\n \\******************************************************************/\n/***/ (function(__unused_webpack_module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ \"./node_modules/@babel/runtime/helpers/interopRequireDefault.js\");\nvar _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ \"./node_modules/@babel/runtime/helpers/typeof.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = registerCore;\nvar _raven = _interopRequireDefault(__webpack_require__(/*! ./raven/raven */ \"./packages/@logrocket/exceptions/src/raven/raven.js\"));\nvar Capture = _interopRequireWildcard(__webpack_require__(/*! ./Capture */ \"./packages/@logrocket/exceptions/src/Capture.js\"));\nfunction _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== \"function\") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }\nfunction _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== \"object\" && typeof obj !== \"function\") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== \"default\" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }\nfunction registerCore(logger) {\n var raven = new _raven.default({\n captureException: function captureException(errorReport) {\n Capture.captureException(logger, null, null, errorReport);\n }\n });\n var rejectionHandler = function rejectionHandler(evt) {\n // http://2ality.com/2016/04/unhandled-rejections.html\n if (evt.reason instanceof Error) {\n Capture.captureException(logger, evt.reason, null, null, 'UNHANDLED_REJECTION');\n } else {\n logger.addEvent('lr.core.Exception', function () {\n return {\n exceptionType: 'UNHANDLED_REJECTION',\n message: evt.reason || 'Unhandled Promise rejection'\n };\n });\n }\n };\n window.addEventListener('unhandledrejection', rejectionHandler);\n return function () {\n window.removeEventListener('unhandledrejection', rejectionHandler);\n raven.uninstall();\n };\n}\n\n/***/ }),\n\n/***/ \"./packages/@logrocket/exceptions/src/stackTraceFromError.js\":\n/*!*******************************************************************!*\\\n !*** ./packages/@logrocket/exceptions/src/stackTraceFromError.js ***!\n \\*******************************************************************/\n/***/ (function(__unused_webpack_module, exports) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = stackTraceFromError;\nfunction stackTraceFromError(errorReport) {\n function makeNotNull(val) {\n return val === null ? undefined : val;\n }\n return errorReport.stack ? errorReport.stack.map(function (frame) {\n return {\n lineNumber: makeNotNull(frame.line),\n columnNumber: makeNotNull(frame.column),\n fileName: makeNotNull(frame.url),\n functionName: makeNotNull(frame.func)\n };\n }) : undefined;\n}\n\n/***/ }),\n\n/***/ \"./packages/@logrocket/network/src/fetchIntercept.js\":\n/*!***********************************************************!*\\\n !*** ./packages/@logrocket/network/src/fetchIntercept.js ***!\n \\***********************************************************/\n/***/ (function(__unused_webpack_module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ \"./node_modules/@babel/runtime/helpers/interopRequireDefault.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\nvar _toConsumableArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ \"./node_modules/@babel/runtime/helpers/toConsumableArray.js\"));\nvar _registerXHR = __webpack_require__(/*! ./registerXHR */ \"./packages/@logrocket/network/src/registerXHR.js\");\nvar interceptors = [];\nfunction makeInterceptor(fetch, fetchId) {\n var reversedInterceptors = interceptors.reduce(function (array, interceptor) {\n return [interceptor].concat(array);\n }, []);\n // if a browser supports fetch, it supports promise\n // eslint-disable-next-line compat/compat\n for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {\n args[_key - 2] = arguments[_key];\n }\n var promise = Promise.resolve(args);\n\n // Register request interceptors\n reversedInterceptors.forEach(function (_ref) {\n var request = _ref.request,\n requestError = _ref.requestError;\n if (request || requestError) {\n promise = promise.then(function (args) {\n return request.apply(void 0, [fetchId].concat((0, _toConsumableArray2.default)(args)));\n }, function (args) {\n return requestError.apply(void 0, [fetchId].concat((0, _toConsumableArray2.default)(args)));\n });\n }\n });\n promise = promise.then(function (args) {\n (0, _registerXHR.setActive)(false);\n var res;\n var err;\n try {\n res = fetch.apply(void 0, (0, _toConsumableArray2.default)(args));\n } catch (_err) {\n err = _err;\n }\n (0, _registerXHR.setActive)(true);\n if (err) {\n throw err;\n }\n return res;\n });\n reversedInterceptors.forEach(function (_ref2) {\n var response = _ref2.response,\n responseError = _ref2.responseError;\n if (response || responseError) {\n promise = promise.then(function (res) {\n return response(fetchId, res);\n }, function (err) {\n return responseError && responseError(fetchId, err);\n });\n }\n });\n return promise;\n}\nfunction attach(env) {\n if (!env.fetch || !env.Promise) {\n // Make sure fetch is available in the given environment. If it's not, then\n // default to using XHR intercept.\n return;\n }\n var isPolyfill = env.fetch.polyfill;\n\n // eslint-disable-next-line no-param-reassign\n env.fetch = function (fetch) {\n var fetchId = 0;\n return function () {\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n return makeInterceptor.apply(void 0, [fetch, fetchId++].concat(args));\n };\n }(env.fetch);\n\n // Forward the polyfill properly from fetch (set by github/whatwg-fetch).\n if (isPolyfill) {\n // eslint-disable-next-line no-param-reassign\n env.fetch.polyfill = isPolyfill;\n }\n}\n\n// TODO: React Native\n// attach(global);\n\nvar didAttach = false;\nvar _default = {\n register: function register(interceptor) {\n if (!didAttach) {\n didAttach = true;\n attach(window);\n }\n interceptors.push(interceptor);\n return function () {\n var index = interceptors.indexOf(interceptor);\n if (index >= 0) {\n interceptors.splice(index, 1);\n }\n };\n },\n clear: function clear() {\n interceptors = [];\n }\n};\nexports[\"default\"] = _default;\n\n/***/ }),\n\n/***/ \"./packages/@logrocket/network/src/index.js\":\n/*!**************************************************!*\\\n !*** ./packages/@logrocket/network/src/index.js ***!\n \\**************************************************/\n/***/ (function(__unused_webpack_module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ \"./node_modules/@babel/runtime/helpers/interopRequireDefault.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = registerNetwork;\nvar _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ \"./node_modules/@babel/runtime/helpers/defineProperty.js\"));\nvar _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ \"./node_modules/@babel/runtime/helpers/typeof.js\"));\nvar _registerFetch = _interopRequireDefault(__webpack_require__(/*! ./registerFetch */ \"./packages/@logrocket/network/src/registerFetch.js\"));\nvar _registerIonic = __webpack_require__(/*! ./registerIonic */ \"./packages/@logrocket/network/src/registerIonic.ts\");\nvar _registerNetworkInformation = _interopRequireDefault(__webpack_require__(/*! ./registerNetworkInformation */ \"./packages/@logrocket/network/src/registerNetworkInformation.js\"));\nvar _registerXHR = _interopRequireDefault(__webpack_require__(/*! ./registerXHR */ \"./packages/@logrocket/network/src/registerXHR.js\"));\nvar _mapValues = _interopRequireDefault(__webpack_require__(/*! @logrocket/utils/src/mapValues */ \"./packages/@logrocket/utils/src/mapValues.js\"));\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\n// eslint-disable-line no-restricted-imports\n\nfunction registerNetwork(logger) {\n var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {\n isReactNative: false,\n isDisabled: false\n };\n if ((config === null || config === void 0 ? void 0 : config.isDisabled) === true) {\n return function () {};\n }\n var isReactNative = config.isReactNative,\n shouldAugmentNPS = config.shouldAugmentNPS,\n shouldParseXHRBlob = config.shouldParseXHRBlob;\n var ignoredNetwork = {};\n\n // truncate if > 4MB in size\n var truncate = function truncate(data) {\n var limit = 1024 * 1000 * 4;\n var str = data;\n if ((0, _typeof2.default)(data) === 'object' && data != null) {\n var proto = Object.getPrototypeOf(data);\n if (proto === Object.prototype || proto === null) {\n // plain object - jsonify for the size check\n str = JSON.stringify(data);\n }\n }\n if (str && str.length && str.length > limit && typeof str === 'string') {\n var beginning = str.substring(0, 1000);\n return \"\".concat(beginning, \" ... LogRocket truncating to first 1000 characters.\\n Keep data under 4MB to prevent truncation. https://docs.logrocket.com/reference/network\");\n }\n return data;\n };\n var addRequest = function addRequest(reqId, request) {\n var method = request.method;\n logger.addEvent('lr.network.RequestEvent', function () {\n var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n _ref$isEnabled = _ref.isEnabled,\n isEnabled = _ref$isEnabled === void 0 ? true : _ref$isEnabled,\n _ref$requestSanitizer = _ref.requestSanitizer,\n requestSanitizer = _ref$requestSanitizer === void 0 ? function (f) {\n return f;\n } : _ref$requestSanitizer;\n if (!isEnabled) {\n return null;\n }\n var sanitized = null;\n try {\n // only try catch user defined functions\n sanitized = requestSanitizer(_objectSpread(_objectSpread({}, request), {}, {\n reqId: reqId\n }));\n } catch (err) {\n console.error(err);\n }\n if (sanitized) {\n var url = sanitized.url;\n if (typeof document !== 'undefined' && typeof document.createElement === 'function') {\n // Writing and then reading from an a tag turns a relative\n // url into an absolute one.\n var a = document.createElement('a');\n a.href = sanitized.url;\n url = a.href;\n }\n return {\n reqId: reqId,\n // default\n url: url,\n // sanitized\n headers: (0, _mapValues.default)(sanitized.headers, function (headerValue) {\n // sanitized\n return \"\".concat(headerValue);\n }),\n body: truncate(sanitized.body),\n // sanitized\n method: method,\n // default\n referrer: sanitized.referrer || undefined,\n // sanitized\n mode: sanitized.mode || undefined,\n // sanitized\n credentials: sanitized.credentials || undefined // sanitized\n };\n }\n\n ignoredNetwork[reqId] = true;\n return null;\n });\n };\n var addResponse = function addResponse(reqId, response) {\n var method = response.method,\n status = response.status;\n logger.addEvent('lr.network.ResponseEvent', function () {\n var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n _ref2$isEnabled = _ref2.isEnabled,\n isEnabled = _ref2$isEnabled === void 0 ? true : _ref2$isEnabled,\n _ref2$responseSanitiz = _ref2.responseSanitizer,\n responseSanitizer = _ref2$responseSanitiz === void 0 ? function (f) {\n return f;\n } : _ref2$responseSanitiz;\n if (!isEnabled) {\n return null;\n } else if (ignoredNetwork[reqId]) {\n delete ignoredNetwork[reqId];\n return null;\n }\n var sanitized = null;\n try {\n // only try catch user defined functions\n sanitized = responseSanitizer(_objectSpread(_objectSpread({}, response), {}, {\n reqId: reqId\n }));\n } catch (err) {\n console.error(err);\n // fall through to redacted log\n }\n\n if (sanitized) {\n return {\n reqId: reqId,\n // default\n status: sanitized.status,\n // sanitized\n headers: (0, _mapValues.default)(sanitized.headers, function (headerValue) {\n // sanitized\n return \"\".concat(headerValue);\n }),\n body: truncate(sanitized.body),\n // sanitized\n method: method // default\n };\n }\n\n return {\n reqId: reqId,\n // default\n status: status,\n // default\n headers: {},\n // redacted\n body: null,\n // redacted\n method: method // default\n };\n });\n };\n\n var isIgnored = function isIgnored(reqId) {\n return logger.isDisabled || ignoredNetwork[reqId] === true;\n };\n var unsubFetch = (0, _registerFetch.default)({\n addRequest: addRequest,\n addResponse: addResponse,\n isIgnored: isIgnored\n });\n var unsubXHR = (0, _registerXHR.default)({\n addRequest: addRequest,\n addResponse: addResponse,\n isIgnored: isIgnored,\n logger: logger,\n shouldAugmentNPS: shouldAugmentNPS,\n shouldParseXHRBlob: shouldParseXHRBlob\n });\n var unsubIonic = (0, _registerIonic.registerIonic)({\n addRequest: addRequest,\n addResponse: addResponse,\n isIgnored: isIgnored\n });\n var unsubNetworkInformation = isReactNative ? function () {} : (0, _registerNetworkInformation.default)(logger);\n return function () {\n unsubNetworkInformation();\n unsubFetch();\n unsubXHR();\n unsubIonic();\n };\n}\n\n/***/ }),\n\n/***/ \"./packages/@logrocket/network/src/registerFetch.js\":\n/*!**********************************************************!*\\\n !*** ./packages/@logrocket/network/src/registerFetch.js ***!\n \\**********************************************************/\n/***/ (function(__unused_webpack_module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ \"./node_modules/@babel/runtime/helpers/interopRequireDefault.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = registerFetch;\nvar _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ \"./node_modules/@babel/runtime/helpers/defineProperty.js\"));\nvar _mapValues = _interopRequireDefault(__webpack_require__(/*! @logrocket/utils/src/mapValues */ \"./packages/@logrocket/utils/src/mapValues.js\"));\nvar _fetchIntercept = _interopRequireDefault(__webpack_require__(/*! ./fetchIntercept */ \"./packages/@logrocket/network/src/fetchIntercept.js\"));\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction makeObjectFromHeaders(headers) {\n // If using real fetch, we must stringify the Headers object.\n if (headers == null || typeof headers.forEach !== 'function') {\n return headers;\n }\n var result = {};\n headers.forEach(function (value, key) {\n if (result[key]) {\n result[key] = \"\".concat(result[key], \",\").concat(value);\n } else {\n result[key] = \"\".concat(value);\n }\n });\n return result;\n}\n\n// XHR specification is unclear of what types to allow in value so using toString method for now\nvar stringifyHeaders = function stringifyHeaders(headers) {\n return (0, _mapValues.default)(makeObjectFromHeaders(headers), function (value) {\n return \"\".concat(value);\n });\n};\nfunction pluckFetchFields() {\n var arg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return {\n url: arg.url,\n headers: stringifyHeaders(arg.headers),\n method: arg.method && arg.method.toUpperCase(),\n referrer: arg.referrer || undefined,\n mode: arg.mode || undefined,\n credentials: arg.credentials || undefined\n };\n}\nfunction registerFetch(_ref) {\n var addRequest = _ref.addRequest,\n addResponse = _ref.addResponse,\n isIgnored = _ref.isIgnored;\n var LOGROCKET_FETCH_LABEL = 'fetch-';\n var fetchMethodMap = {};\n var unregister = _fetchIntercept.default.register({\n request: function request(fetchId) {\n for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n args[_key - 1] = arguments[_key];\n }\n var p;\n if (typeof Request !== 'undefined' && args[0] instanceof Request) {\n var clonedText;\n\n // Request.clone() and Request.text() may throw in Safari (e.g., when\n // request body contains FormData)\n try {\n clonedText = args[0].clone().text();\n } catch (err) {\n // if a browser supports fetch, it supports promise\n // eslint-disable-next-line compat/compat\n clonedText = Promise.resolve(\"LogRocket fetch error: \".concat(err.message));\n }\n p = clonedText.then(function (body) {\n return _objectSpread(_objectSpread({}, pluckFetchFields(args[0])), {}, {\n body: body\n });\n }, function (err) {\n return _objectSpread(_objectSpread({}, pluckFetchFields(args[0])), {}, {\n body: \"LogRocket fetch error: \".concat(err.message)\n });\n });\n } else {\n // if a browser supports fetch, it supports promise\n // eslint-disable-next-line compat/compat\n p = Promise.resolve(_objectSpread(_objectSpread({}, pluckFetchFields(args[1])), {}, {\n url: \"\".concat(args[0]),\n body: (args[1] || {}).body\n }));\n }\n return p.then(function (req) {\n fetchMethodMap[fetchId] = req.method;\n addRequest(\"\".concat(LOGROCKET_FETCH_LABEL).concat(fetchId), req);\n return args;\n });\n },\n requestError: function requestError(fetchId, error) {\n // if a browser supports fetch, it supports promise\n // eslint-disable-next-line compat/compat\n return Promise.reject(error);\n },\n response: function response(fetchId, _response) {\n var responseClone;\n var responseTextPromise;\n if (isIgnored(\"\".concat(LOGROCKET_FETCH_LABEL).concat(fetchId))) {\n // Don't even try to read ignored requests\n return _response;\n }\n\n // event-streams are meant to remain open and be consumed over time by the sender. Attempting to capture the body\n // of these requests will cause us to \"stall\" here, and prevents the users of our SDK from using event-streams\n // unless they have explicitly ignored the request.\n if (_response.headers.get('content-type') === 'text/event-stream') {\n // eslint-disable-next-line compat/compat\n responseTextPromise = Promise.resolve('LogRocket skipped consuming an event-stream body.');\n } else {\n try {\n // TODO: enhance function on original response and future clones for:\n // text(), json(), blob(), formdata(), arraybuffer()\n responseClone = _response.clone();\n } catch (err) {\n // safari has a bug where cloning can fail\n var responseHash = {\n url: _response.url,\n status: _response.status,\n headers: stringifyHeaders(_response.headers),\n body: \"LogRocket fetch error: \".concat(err.message),\n method: fetchMethodMap[fetchId]\n };\n delete fetchMethodMap[fetchId];\n addResponse(\"\".concat(LOGROCKET_FETCH_LABEL).concat(fetchId), responseHash);\n return _response;\n }\n try {\n if (window.TextDecoder && responseClone.body) {\n // use a reader to manually read the response body rather than calling response.text()\n // response.text() was timing out for some responses, in some cases because Apollo sends\n // an abort signal or because the stream wasn't getting terminated cleanly\n // using a reader allows us to capture what we can from response bodies before the\n // response receives an abort signal\n var reader = responseClone.body.getReader();\n // response bodies always decode with UTF-8\n // https://developer.mozilla.org/en-US/docs/Web/API/Response/text\n var utf8Decoder = new window.TextDecoder('utf-8');\n var bodyContents = '';\n responseTextPromise = reader.read().then(function readResponseBody(_ref2) {\n var done = _ref2.done,\n value = _ref2.value;\n if (done) {\n return bodyContents;\n }\n var chunk = value ? utf8Decoder.decode(value, {\n stream: true\n }) : '';\n bodyContents += chunk;\n return reader.read().then(readResponseBody);\n });\n } else {\n // TextDecoder doesn't have support across all browsers that LR supports, so if there's\n // no TextDecoder, fall back to the old approach\n responseTextPromise = responseClone.text();\n }\n } catch (error) {\n // eslint-disable-next-line compat/compat\n responseTextPromise = Promise.resolve(\"LogRocket error reading body: \".concat(error.message));\n }\n }\n responseTextPromise.catch(function (error) {\n // don't drop request & log to console when the request is aborted,\n // as it may have already completed\n // https://github.com/LogRocket/logrocket/issues/34\n if (error.name === 'AbortError' && error instanceof DOMException) {\n return;\n }\n return \"LogRocket error reading body: \".concat(error.message);\n }).then(function (data) {\n var responseHash = {\n url: _response.url,\n status: _response.status,\n headers: stringifyHeaders(_response.headers),\n body: data,\n method: fetchMethodMap[fetchId]\n };\n delete fetchMethodMap[fetchId];\n addResponse(\"\".concat(LOGROCKET_FETCH_LABEL).concat(fetchId), responseHash);\n });\n return _response;\n },\n responseError: function responseError(fetchId, error) {\n var response = {\n url: undefined,\n status: 0,\n headers: {},\n body: \"\".concat(error)\n };\n addResponse(\"\".concat(LOGROCKET_FETCH_LABEL).concat(fetchId), response);\n // if a browser supports fetch, it supports promise\n // eslint-disable-next-line compat/compat\n return Promise.reject(error);\n }\n });\n return unregister;\n}\n\n/***/ }),\n\n/***/ \"./packages/@logrocket/network/src/registerIonic.ts\":\n/*!**********************************************************!*\\\n !*** ./packages/@logrocket/network/src/registerIonic.ts ***!\n \\**********************************************************/\n/***/ (function(__unused_webpack_module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ \"./node_modules/@babel/runtime/helpers/interopRequireDefault.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports.mergeHeaders = mergeHeaders;\nexports.serializeQueryParams = serializeQueryParams;\nexports.appendQueryParamsString = appendQueryParamsString;\nexports.processData = processData;\nexports.registerIonic = registerIonic;\nvar _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ \"./node_modules/@babel/runtime/helpers/defineProperty.js\"));\nvar _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ \"./node_modules/@babel/runtime/helpers/typeof.js\"));\nvar _toConsumableArray2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ \"./node_modules/@babel/runtime/helpers/toConsumableArray.js\"));\nvar _protectFunc = _interopRequireDefault(__webpack_require__(/*! @logrocket/utils/src/protectFunc */ \"./packages/@logrocket/utils/src/protectFunc.js\"));\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nvar VALID_HTTP_METHODS = new Set(['get', 'put', 'post', 'patch', 'head', 'delete', 'options', 'upload', 'download']);\nvar VALID_SERIALIZERS = new Set(['urlencoded', 'json', 'utf8']);\nvar UNSUPPORTED_SERIALIZERS = new Set(['raw', 'multipart']);\nvar LOGROCKET_IONIC_LABEL = 'ionic-';\nvar UNSUPPORTED_PLATFORMS = new Set(['desktop', 'mobileweb', 'pwa']);\nvar FORM_DATA = new Set(['FormData']);\nvar EMPTY_SET = new Set();\nvar STRING_SET = new Set(['string']);\nvar STRING_ARRAY_SET = new Set(['string', 'array']);\nvar ALLOWED_DATA_TYPES = {\n utf8: STRING_SET,\n urlencoded: new Set(['object']),\n json: new Set(['array', 'object']),\n raw: new Set(['Uint8Array', 'ArrayBuffer']),\n default: EMPTY_SET\n};\n\n// Used in intercepting Ionic pugin requests found here https://www.npmjs.com/package/@ionic-native/http\n// based on https://github.com/silkimen/cordova-plugin-advanced-http/blob/master/www/public-interface.js\n\nfunction checkForValidStringValue(list, value, fieldName) {\n if (typeof value !== 'string') {\n throw new Error(\"\".concat(fieldName, \" must be one of: \").concat((0, _toConsumableArray2.default)(list).join(', ')));\n }\n\n // eslint-disable-next-line no-param-reassign\n value = value.trim().toLowerCase();\n if (!list.has(value)) {\n throw new Error(\"\".concat(fieldName, \" must be one of: \").concat((0, _toConsumableArray2.default)(list).join(', ')));\n }\n return value;\n}\nfunction checkKeyValuePairObject(obj, allowedChildren, onInvalidValueMessage) {\n if ((0, _typeof2.default)(obj) !== 'object') {\n throw new Error(onInvalidValueMessage);\n }\n for (var _i = 0, _Object$keys = Object.keys(obj); _i < _Object$keys.length; _i++) {\n var key = _Object$keys[_i];\n if (!allowedChildren.has((0, _typeof2.default)(obj[key]))) {\n throw new Error(onInvalidValueMessage);\n }\n }\n return obj;\n}\nfunction getMatchingHostHeaders(url, ionicHttp) {\n var _URL = new URL(url),\n host = _URL.host;\n return ionicHttp.getHeaders(host) || null;\n}\nfunction mergeHeaders(defaultHeaders, headers) {\n return _objectSpread(_objectSpread({}, defaultHeaders), headers);\n}\nfunction getMergedHeaders(url, requestHeaders, ionicHttp) {\n // get global headers via public method\n var globalHeaders = ionicHttp.getHeaders('*') || {};\n var hostHeaders = getMatchingHostHeaders(url, ionicHttp) || {};\n return mergeHeaders(mergeHeaders(globalHeaders, hostHeaders), requestHeaders);\n}\nfunction serializeValue(value, encode) {\n if (encode) {\n return encodeURIComponent(value);\n } else {\n return value;\n }\n}\nfunction serializeIdentifier(parentKey, key, encode) {\n if (!parentKey.length) {\n return encode ? encodeURIComponent(key) : key;\n }\n if (encode) {\n return \"\".concat(encodeURIComponent(parentKey), \"[\").concat(encodeURIComponent(key), \"]\");\n } else {\n return \"\".concat(parentKey, \"[\").concat(key, \"]\");\n }\n}\nfunction serializeArray(parentKey, array, encode) {\n var parts = [];\n var _iterator = _createForOfIteratorHelper(array),\n _step;\n try {\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n var e = _step.value;\n if (Array.isArray(e)) {\n parts.push(serializeArray(\"\".concat(parentKey, \"[]\"), e, encode));\n continue;\n } else if ((0, _typeof2.default)(e) === 'object') {\n /* This replicates what appears to be a bug in the Ionic code in order to capture everything identically\n parts.push(serializeObject(`${parentKey}[]${array[i]}`, encode));\n https://github.com/silkimen/cordova-plugin-advanced-http/blob/master/www/url-util.js#L73\n */\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n parts.push(serializeObject(\"\".concat(parentKey, \"[]\").concat(e), encode, undefined));\n continue;\n }\n parts.push(\"\".concat(serializeIdentifier(parentKey, '', encode), \"=\").concat(serializeValue(e, encode)));\n }\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n return parts.join('&');\n}\nfunction serializeObject(parentKey, object, encode) {\n var parts = [];\n for (var key in object) {\n if (!object.hasOwnProperty(key)) {\n continue;\n }\n var identifier = parentKey.length ? \"\".concat(parentKey, \"[\").concat(key, \"]\") : key;\n if (Array.isArray(object[key])) {\n parts.push(serializeArray(identifier, object[key], encode));\n continue;\n } else if ((0, _typeof2.default)(object[key]) === 'object' && object[key] !== null) {\n parts.push(serializeObject(identifier, object[key], encode));\n continue;\n }\n parts.push(\"\".concat(serializeIdentifier(parentKey, key, encode), \"=\").concat(serializeValue(object[key], encode)));\n }\n return parts.join('&');\n}\nfunction serializeQueryParams(params, encode) {\n return serializeObject('', params, encode);\n}\nfunction appendQueryParamsString(url, params) {\n if (!url.length || !params.length) {\n return url;\n }\n var _URL2 = new URL(url),\n host = _URL2.host,\n pathname = _URL2.pathname,\n search = _URL2.search,\n hash = _URL2.hash,\n protocol = _URL2.protocol;\n return \"\".concat(protocol, \"//\").concat(host).concat(pathname).concat(search.length ? \"\".concat(search, \"&\").concat(params) : \"?\".concat(params)).concat(hash);\n}\nfunction getAllowedDataTypes(dataSerializer) {\n return ALLOWED_DATA_TYPES[dataSerializer] || ALLOWED_DATA_TYPES.default;\n}\nfunction getAllowedInstanceTypes(dataSerializer) {\n return dataSerializer === 'multipart' ? FORM_DATA : EMPTY_SET;\n}\nfunction processData(data, dataSerializer) {\n var currentDataType = (0, _typeof2.default)(data);\n var allowedDataTypes = getAllowedDataTypes(dataSerializer);\n var allowedInstanceTypes = getAllowedInstanceTypes(dataSerializer);\n if (allowedInstanceTypes.size > 0) {\n var isCorrectInstanceType = false;\n allowedInstanceTypes.forEach(function (type) {\n if (__webpack_require__.g[type] && data instanceof __webpack_require__.g[type]) {\n isCorrectInstanceType = true;\n }\n });\n if (!isCorrectInstanceType) {\n throw new Error(\"INSTANCE_TYPE_MISMATCH_DATA \".concat((0, _toConsumableArray2.default)(allowedInstanceTypes).join(', ')));\n }\n }\n if (allowedInstanceTypes.size === 0 && !allowedDataTypes.has(currentDataType)) {\n throw new Error(\"TYPE_MISMATCH_DATA \".concat((0, _toConsumableArray2.default)(allowedDataTypes).join(', ')));\n }\n switch (dataSerializer) {\n case 'utf8':\n // already a string\n return data;\n default:\n // object of some sort (urlencoded or json)\n return JSON.stringify(data, undefined, 2);\n }\n}\nfunction handleMissingOptions(options, ionicHttp) {\n // eslint-disable-next-line no-param-reassign\n options = options || {};\n var serializer;\n var data = options.data;\n try {\n // need to check special case if data type is not handled by LR but otherwise valid\n serializer = checkForValidStringValue(VALID_SERIALIZERS, options.serializer || ionicHttp.getDataSerializer(), 'serializer / data payload type');\n } catch (_unused) {\n // if this fails it's of entirely invalid type, let it fail\n serializer = checkForValidStringValue(UNSUPPORTED_SERIALIZERS, options.serializer || ionicHttp.getDataSerializer(), 'serializer / data payload type');\n // is of a valid but unsupported to LR type, set data to empty\n data = {};\n }\n return {\n data: data,\n filePath: options.filePath,\n followRedirect: options.followRedirect,\n headers: checkKeyValuePairObject(options.headers || {}, STRING_SET, 'Invalid header type, must be string'),\n method: checkForValidStringValue(VALID_HTTP_METHODS, options.method || VALID_HTTP_METHODS[0], 'method'),\n name: options.name,\n params: checkKeyValuePairObject(options.params || {}, STRING_ARRAY_SET, 'Invalid param, must be of type string or array'),\n responseType: options.responseType,\n serializer: serializer,\n connectTimeout: options.connectTimeout,\n readTimeout: options.readTimeout,\n timeout: options.timeout\n };\n}\nvar ionicIdCounter = 0;\nfunction registerIonic(_ref) {\n var _cordova, _cordova$plugin, _window$ionic;\n var addRequest = _ref.addRequest,\n addResponse = _ref.addResponse,\n isIgnored = _ref.isIgnored;\n var ionicHttp = (_cordova = window.cordova) === null || _cordova === void 0 ? void 0 : (_cordova$plugin = _cordova.plugin) === null || _cordova$plugin === void 0 ? void 0 : _cordova$plugin.http;\n var ionicMap = {};\n var unsubscribedFromIonic = false;\n if (typeof ionicHttp === 'undefined') {\n // Plugin does not exist! Empty uninstall hook.\n return function () {};\n }\n var platforms = (_window$ionic = window.ionic) === null || _window$ionic === void 0 ? void 0 : _window$ionic.platforms;\n if (typeof platforms !== 'undefined' && typeof platforms.some === 'function' && platforms.some(function (e) {\n return UNSUPPORTED_PLATFORMS.has(e);\n })) {\n // We appear to be running in a web browser, do not hook and let XHR wrap instead.\n return function () {};\n }\n var originalSendRequest = ionicHttp.sendRequest;\n var handleResponse = (0, _protectFunc.default)(function (response, isSuccess, ionicReqId) {\n if (!isIgnored(\"\".concat(LOGROCKET_IONIC_LABEL).concat(ionicReqId))) {\n try {\n var responseHash = {\n url: response.url || '',\n status: response.status < 600 && response.status >= 100 ? response.status : 0,\n headers: response.headers || {},\n body: isSuccess ? response.data : response.error,\n method: ionicMap[ionicReqId].toUpperCase()\n };\n addResponse(\"\".concat(LOGROCKET_IONIC_LABEL).concat(ionicReqId), responseHash);\n } catch (err) {\n var _responseHash = {\n url: response.url || '',\n status: response.status < 600 && response.status >= 100 ? response.status : 0,\n headers: response.headers || {},\n body: \"LogRocket fetch error: \".concat(err.message),\n method: ionicMap[ionicReqId].toUpperCase()\n };\n addResponse(\"\".concat(LOGROCKET_IONIC_LABEL).concat(ionicReqId), _responseHash);\n }\n } // Otherwise, don't even try to read ignored / unsubscribed requests\n });\n\n ionicHttp.sendRequest = function (url, options, success, failure) {\n var currentId = ++ionicIdCounter;\n var ourSuccessHandler = function ourSuccessHandler(response) {\n if (!unsubscribedFromIonic) {\n handleResponse(response, true, currentId);\n delete ionicMap[currentId];\n }\n success(response);\n };\n var ourFailureHandler = function ourFailureHandler(response) {\n if (!unsubscribedFromIonic) {\n handleResponse(response, false, currentId);\n delete ionicMap[currentId];\n }\n failure(response);\n };\n if (!unsubscribedFromIonic) {\n try {\n // will throw just like identical ionic code if input is invalid\n var modifiedOptions = handleMissingOptions(options, ionicHttp);\n var modifiedUrl = appendQueryParamsString(url, serializeObject('', modifiedOptions.params, true));\n // need to minic behavior of Ionic API by adding global headers\n var mergedHeaders = getMergedHeaders(url, modifiedOptions.headers, ionicHttp);\n\n // ionic APIs default to get method\n var method = modifiedOptions.method || 'get';\n ionicMap[currentId] = method;\n var requestHash = {\n url: modifiedUrl,\n method: method.toUpperCase(),\n headers: mergedHeaders || {},\n // only applicable on post, put or patch methods\n body: processData(modifiedOptions.data || {}, modifiedOptions.serializer)\n };\n addRequest(\"\".concat(LOGROCKET_IONIC_LABEL).concat(currentId), requestHash);\n } catch (err) {\n var _requestHash = {\n url: url,\n method: (options.method || 'get').toUpperCase(),\n headers: {},\n body: \"LogRocket fetch error: \".concat(err.message)\n };\n addRequest(\"\".concat(LOGROCKET_IONIC_LABEL).concat(currentId), _requestHash);\n }\n }\n return originalSendRequest(url, options, ourSuccessHandler, ourFailureHandler);\n };\n return function () {\n unsubscribedFromIonic = true;\n ionicHttp.sendRequest = originalSendRequest;\n ionicMap = {};\n };\n}\n\n/***/ }),\n\n/***/ \"./packages/@logrocket/network/src/registerNetworkInformation.js\":\n/*!***********************************************************************!*\\\n !*** ./packages/@logrocket/network/src/registerNetworkInformation.js ***!\n \\***********************************************************************/\n/***/ (function(__unused_webpack_module, exports) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = registerNetworkInformation;\nvar EFFECTIVE_TYPE_VALS = {\n 'slow-2g': 'SLOW2G',\n '2g': 'TWOG',\n '3g': 'THREEG',\n '4g': 'FOURG'\n};\nfunction registerNetworkInformation(logger) {\n var lastStatus = undefined;\n function sendNetworkInformation() {\n var newStatus = {\n online: window.navigator.onLine,\n effectiveType: 'UNKOWN'\n };\n if (!window.navigator.onLine) {\n newStatus.effectiveType = 'NONE';\n } else if (window.navigator.connection && window.navigator.connection.effectiveType) {\n newStatus.effectiveType = EFFECTIVE_TYPE_VALS[window.navigator.connection.effectiveType] || 'UNKNOWN';\n }\n if (lastStatus && newStatus.online === lastStatus.online && newStatus.effectiveType === lastStatus.effectiveType) {\n return;\n }\n lastStatus = newStatus;\n logger.addEvent('lr.network.NetworkStatusEvent', function () {\n var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n _ref$isEnabled = _ref.isEnabled,\n isEnabled = _ref$isEnabled === void 0 ? true : _ref$isEnabled;\n if (!isEnabled) {\n return null;\n }\n return newStatus;\n });\n }\n setTimeout(sendNetworkInformation);\n if (window.navigator.connection && typeof window.navigator.connection.addEventListener === 'function') {\n window.navigator.connection.addEventListener('change', sendNetworkInformation);\n }\n window.addEventListener('online', sendNetworkInformation);\n window.addEventListener('offline', sendNetworkInformation);\n return function () {\n window.removeEventListener('offline', sendNetworkInformation);\n window.removeEventListener('online', sendNetworkInformation);\n if (window.navigator.connection && typeof window.navigator.connection.removeEventListener === 'function') {\n window.navigator.connection.removeEventListener('change', sendNetworkInformation);\n }\n };\n}\n\n/***/ }),\n\n/***/ \"./packages/@logrocket/network/src/registerXHR.js\":\n/*!********************************************************!*\\\n !*** ./packages/@logrocket/network/src/registerXHR.js ***!\n \\********************************************************/\n/***/ (function(__unused_webpack_module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ \"./node_modules/@babel/runtime/helpers/interopRequireDefault.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports.setActive = setActive;\nexports[\"default\"] = registerXHR;\nvar _mapValues = _interopRequireDefault(__webpack_require__(/*! @logrocket/utils/src/mapValues */ \"./packages/@logrocket/utils/src/mapValues.js\"));\nvar _enhanceFunc = _interopRequireDefault(__webpack_require__(/*! @logrocket/utils/src/enhanceFunc */ \"./packages/@logrocket/utils/src/enhanceFunc.ts\"));\nvar _startsWith = _interopRequireDefault(__webpack_require__(/*! @logrocket/utils/src/startsWith */ \"./packages/@logrocket/utils/src/startsWith.js\"));\nvar _nps = __webpack_require__(/*! @logrocket/utils/src/constants/nps */ \"./packages/@logrocket/utils/src/constants/nps.js\");\n// eslint-disable-line no-restricted-imports\n// eslint-disable-line no-restricted-imports\n// eslint-disable-line no-restricted-imports\n\nvar isActive = true;\nfunction setActive(shouldBeActive) {\n isActive = shouldBeActive;\n}\nvar currentXHRId = 0;\nfunction registerXHR(_ref) {\n var addRequest = _ref.addRequest,\n addResponse = _ref.addResponse,\n isIgnored = _ref.isIgnored,\n logger = _ref.logger,\n _ref$shouldAugmentNPS = _ref.shouldAugmentNPS,\n shouldAugmentNPS = _ref$shouldAugmentNPS === void 0 ? true : _ref$shouldAugmentNPS,\n _ref$shouldParseXHRBl = _ref.shouldParseXHRBlob,\n shouldParseXHRBlob = _ref$shouldParseXHRBl === void 0 ? false : _ref$shouldParseXHRBl;\n var _XHR = XMLHttpRequest;\n var xhrMap = new WeakMap();\n var unsubscribedFromXhr = false;\n var LOGROCKET_XHR_LABEL = 'xhr-';\n window._lrXMLHttpRequest = XMLHttpRequest;\n\n // eslint-disable-next-line no-native-reassign\n XMLHttpRequest = function XMLHttpRequest(mozAnon, mozSystem) {\n var xhrObject = new _XHR(mozAnon, mozSystem);\n if (!isActive) {\n return xhrObject;\n }\n xhrMap.set(xhrObject, {\n xhrId: ++currentXHRId,\n headers: {}\n });\n var openOriginal = xhrObject.open;\n function openShim() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n try {\n var url = args[1];\n if (window.URL && typeof window.URL === 'function' && url.search(_nps.WOOTRIC_RESPONSES_REGEX) === 0) {\n var logrocketSessionURL = new window.URL(logger.recordingURL);\n logrocketSessionURL.searchParams.set('nps', 'wootric');\n var urlObj = new window.URL(url);\n var responseText = urlObj.searchParams.get('response[text]');\n var feedback = responseText ? \"\".concat(responseText, \"\\n\\n\") : '';\n urlObj.searchParams.set('response[text]', \"\".concat(feedback, \"<\").concat(logrocketSessionURL.href, \"|View LogRocket session>\"));\n args[1] = urlObj.href; // eslint-disable-line no-param-reassign\n }\n } catch (e) {/* do nothing */}\n return openOriginal.apply(this, args);\n }\n var sendOriginal = xhrObject.send;\n function sendShim() {\n for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n try {\n var currentXHR = xhrMap.get(xhrObject);\n if (window.URL && typeof window.URL === 'function' && currentXHR && currentXHR.url && currentXHR.url.search(_nps.DELIGHTED_RESPONSES_REGEX) === 0 && args.length && args[0].indexOf(_nps.DELIGHTED_FEEDBACK_PREFIX) !== -1) {\n var recordingURL = new window.URL(logger.recordingURL);\n recordingURL.searchParams.set('nps', 'delighted');\n var logrocketSessionURL = encodeURIComponent(recordingURL.href);\n var data = args[0].split('&').map(function (dataString) {\n if ((0, _startsWith.default)(dataString, _nps.DELIGHTED_FEEDBACK_PREFIX)) {\n var isEmpty = dataString === _nps.DELIGHTED_FEEDBACK_PREFIX;\n return \"\".concat(dataString).concat(isEmpty ? '' : '\\n\\n', \"<\").concat(logrocketSessionURL, \"|View LogRocket session>\");\n }\n return dataString;\n }).join('&');\n args[0] = data; // eslint-disable-line no-param-reassign\n }\n } catch (e) {/* do nothing */}\n return sendOriginal.apply(this, args);\n }\n if (shouldAugmentNPS) {\n xhrObject.open = openShim;\n xhrObject.send = sendShim;\n }\n\n // ..., 'open', (method, url, async, username, password) => {\n (0, _enhanceFunc.default)(xhrObject, 'open', function (method, url) {\n if (unsubscribedFromXhr) {\n return;\n }\n var currentXHR = xhrMap.get(xhrObject);\n currentXHR.method = method;\n currentXHR.url = url;\n });\n (0, _enhanceFunc.default)(xhrObject, 'send', function (data) {\n if (unsubscribedFromXhr) {\n return;\n }\n var currentXHR = xhrMap.get(xhrObject);\n if (!currentXHR) {\n return;\n }\n var request = {\n url: currentXHR.url,\n method: currentXHR.method && currentXHR.method.toUpperCase(),\n headers: (0, _mapValues.default)(currentXHR.headers || {}, function (headerValues) {\n return headerValues.join(', ');\n }),\n body: data\n };\n addRequest(\"\".concat(LOGROCKET_XHR_LABEL).concat(currentXHR.xhrId), request);\n });\n (0, _enhanceFunc.default)(xhrObject, 'setRequestHeader', function (header, value) {\n if (unsubscribedFromXhr) {\n return;\n }\n var currentXHR = xhrMap.get(xhrObject);\n if (!currentXHR) {\n return;\n }\n currentXHR.headers = currentXHR.headers || {};\n currentXHR.headers[header] = currentXHR.headers[header] || [];\n currentXHR.headers[header].push(value);\n });\n var xhrListeners = {\n readystatechange: function readystatechange() {\n if (unsubscribedFromXhr) {\n return;\n }\n if (xhrObject.readyState === 4) {\n var currentXHR = xhrMap.get(xhrObject);\n if (!currentXHR) {\n return;\n }\n\n // Do not read ignored requests at all.\n if (isIgnored(\"\".concat(LOGROCKET_XHR_LABEL).concat(currentXHR.xhrId))) {\n return;\n }\n var headerString = xhrObject.getAllResponseHeaders() || '';\n var headers = headerString.split(/[\\r\\n]+/).reduce(function (previous, current) {\n var next = previous;\n var headerParts = current.split(': ');\n if (headerParts.length > 0) {\n var key = headerParts.shift(); // first index of the array\n var value = headerParts.join(': '); // rest of the array repaired\n if (previous[key]) {\n next[key] += \", \".concat(value);\n } else {\n next[key] = value;\n }\n }\n return next;\n }, {});\n var body;\n\n // IE 11 sometimes throws when trying to access large responses\n try {\n switch (xhrObject.responseType) {\n case 'json':\n body = logger._shouldCloneResponse ? JSON.parse(JSON.stringify(xhrObject.response)) : xhrObject.response;\n break;\n case 'arraybuffer':\n case 'blob':\n {\n body = xhrObject.response;\n break;\n }\n case 'document':\n {\n body = xhrObject.responseXML;\n break;\n }\n case 'text':\n case '':\n {\n body = xhrObject.responseText;\n break;\n }\n default:\n {\n body = '';\n }\n }\n } catch (err) {\n body = 'LogRocket: Error accessing response.';\n }\n var response = {\n url: currentXHR.url,\n status: xhrObject.status,\n headers: headers,\n body: body,\n method: (currentXHR.method || '').toUpperCase()\n };\n if (shouldParseXHRBlob && response.body instanceof Blob) {\n var blobReader = new FileReader();\n blobReader.readAsText(response.body);\n blobReader.onload = function () {\n try {\n response.body = JSON.parse(blobReader.result);\n } catch (_unused) {} // eslint-disable-line no-empty\n addResponse(\"\".concat(LOGROCKET_XHR_LABEL).concat(currentXHR.xhrId), response);\n };\n } else {\n addResponse(\"\".concat(LOGROCKET_XHR_LABEL).concat(currentXHR.xhrId), response);\n }\n }\n }\n // // Unused Event Listeners\n // loadstart: () => {},\n // progress: () => {},\n // abort: () => {},\n // error: () => {},\n // load: () => {},\n // timeout: () => {},\n // loadend: () => {},\n };\n\n Object.keys(xhrListeners).forEach(function (key) {\n xhrObject.addEventListener(key, xhrListeners[key]);\n });\n return xhrObject;\n };\n\n // this allows \"instanceof XMLHttpRequest\" to work\n XMLHttpRequest.prototype = _XHR.prototype;\n\n // Persist the static variables.\n ['UNSENT', 'OPENED', 'HEADERS_RECEIVED', 'LOADING', 'DONE'].forEach(function (variable) {\n XMLHttpRequest[variable] = _XHR[variable];\n });\n return function () {\n unsubscribedFromXhr = true;\n // eslint-disable-next-line no-native-reassign\n XMLHttpRequest = _XHR;\n };\n}\n\n/***/ }),\n\n/***/ \"./packages/@logrocket/now/src/index.js\":\n/*!**********************************************!*\\\n !*** ./packages/@logrocket/now/src/index.js ***!\n \\**********************************************/\n/***/ (function(__unused_webpack_module, exports) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\n/* eslint-disable compat/compat */\nvar dateNow = Date.now.bind(Date);\nvar loadTime = dateNow();\nvar _default = typeof performance !== 'undefined' && performance.now ? performance.now.bind(performance) : function () {\n return dateNow() - loadTime;\n};\nexports[\"default\"] = _default;\n\n/***/ }),\n\n/***/ \"./packages/@logrocket/redux/src/createEnhancer.js\":\n/*!*********************************************************!*\\\n !*** ./packages/@logrocket/redux/src/createEnhancer.js ***!\n \\*********************************************************/\n/***/ (function(__unused_webpack_module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ \"./node_modules/@babel/runtime/helpers/interopRequireDefault.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = createEnhancer;\nvar _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ \"./node_modules/@babel/runtime/helpers/defineProperty.js\"));\nvar _now = _interopRequireDefault(__webpack_require__(/*! @logrocket/now */ \"./packages/@logrocket/now/src/index.js\"));\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nvar storeIdCounter = 0;\nfunction createEnhancer(logger) {\n var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},\n _ref$stateSanitizer = _ref.stateSanitizer,\n stateSanitizer = _ref$stateSanitizer === void 0 ? function (f) {\n return f;\n } : _ref$stateSanitizer,\n _ref$actionSanitizer = _ref.actionSanitizer,\n actionSanitizer = _ref$actionSanitizer === void 0 ? function (f) {\n return f;\n } : _ref$actionSanitizer;\n // an enhancer is a function that returns a Store\n return function (createStore) {\n return function (reducer, initialState, enhancer) {\n var store = createStore(reducer, initialState, enhancer);\n var originalDispatch = store.dispatch;\n var storeId = storeIdCounter++;\n logger.addEvent('lr.redux.InitialState', function () {\n var sanitizedState;\n try {\n // only try catch user defined functions\n sanitizedState = stateSanitizer(store.getState());\n } catch (err) {\n console.error(err.toString());\n }\n return {\n state: sanitizedState,\n storeId: storeId\n };\n });\n var dispatch = function dispatch(action) {\n var start = (0, _now.default)();\n var err;\n var res;\n try {\n res = originalDispatch(action);\n } catch (_err) {\n err = _err;\n } finally {\n var duration = (0, _now.default)() - start;\n logger.addEvent('lr.redux.ReduxAction', function () {\n var sanitizedState = null;\n var sanitizedAction = null;\n try {\n // only try catch user defined functions\n sanitizedState = stateSanitizer(store.getState());\n sanitizedAction = actionSanitizer(action);\n } catch (err) {\n console.error(err.toString());\n }\n if (sanitizedState && sanitizedAction) {\n return {\n storeId: storeId,\n action: sanitizedAction,\n duration: duration,\n stateDelta: sanitizedState\n };\n }\n return null;\n });\n }\n if (err) {\n throw err;\n }\n return res;\n };\n return _objectSpread(_objectSpread({}, store), {}, {\n dispatch: dispatch\n });\n };\n };\n}\n\n/***/ }),\n\n/***/ \"./packages/@logrocket/redux/src/createMiddleware.js\":\n/*!***********************************************************!*\\\n !*** ./packages/@logrocket/redux/src/createMiddleware.js ***!\n \\***********************************************************/\n/***/ (function(__unused_webpack_module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ \"./node_modules/@babel/runtime/helpers/interopRequireDefault.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = createMiddleware;\nvar _now = _interopRequireDefault(__webpack_require__(/*! @logrocket/now */ \"./packages/@logrocket/now/src/index.js\"));\nvar storeIdCounter = 0;\nfunction createMiddleware(logger) {\n var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},\n _ref$stateSanitizer = _ref.stateSanitizer,\n stateSanitizer = _ref$stateSanitizer === void 0 ? function (f) {\n return f;\n } : _ref$stateSanitizer,\n _ref$actionSanitizer = _ref.actionSanitizer,\n actionSanitizer = _ref$actionSanitizer === void 0 ? function (f) {\n return f;\n } : _ref$actionSanitizer;\n return function (store) {\n var storeId = storeIdCounter++;\n logger.addEvent('lr.redux.InitialState', function () {\n var sanitizedState;\n try {\n // only try catch user defined functions\n sanitizedState = stateSanitizer(store.getState());\n } catch (err) {\n console.error(err.toString());\n }\n return {\n state: sanitizedState,\n storeId: storeId\n };\n });\n return function (next) {\n return function (action) {\n var start = (0, _now.default)();\n var err;\n var res;\n try {\n res = next(action);\n } catch (_err) {\n err = _err;\n } finally {\n var duration = (0, _now.default)() - start;\n logger.addEvent('lr.redux.ReduxAction', function () {\n var sanitizedState = null;\n var sanitizedAction = null;\n try {\n // only try catch user defined functions\n sanitizedState = stateSanitizer(store.getState());\n sanitizedAction = actionSanitizer(action);\n } catch (err) {\n console.error(err.toString());\n }\n if (sanitizedState && sanitizedAction) {\n return {\n storeId: storeId,\n action: sanitizedAction,\n duration: duration,\n stateDelta: sanitizedState\n };\n }\n return null;\n });\n }\n if (err) {\n throw err;\n }\n return res;\n };\n };\n };\n}\n\n/***/ }),\n\n/***/ \"./packages/@logrocket/redux/src/index.js\":\n/*!************************************************!*\\\n !*** ./packages/@logrocket/redux/src/index.js ***!\n \\************************************************/\n/***/ (function(__unused_webpack_module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ \"./node_modules/@babel/runtime/helpers/interopRequireDefault.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nObject.defineProperty(exports, \"createEnhancer\", ({\n enumerable: true,\n get: function get() {\n return _createEnhancer.default;\n }\n}));\nObject.defineProperty(exports, \"createMiddleware\", ({\n enumerable: true,\n get: function get() {\n return _createMiddleware.default;\n }\n}));\nvar _createEnhancer = _interopRequireDefault(__webpack_require__(/*! ./createEnhancer */ \"./packages/@logrocket/redux/src/createEnhancer.js\"));\nvar _createMiddleware = _interopRequireDefault(__webpack_require__(/*! ./createMiddleware */ \"./packages/@logrocket/redux/src/createMiddleware.js\"));\n\n/***/ }),\n\n/***/ \"./packages/@logrocket/utils/src/TraceKit.js\":\n/*!***************************************************!*\\\n !*** ./packages/@logrocket/utils/src/TraceKit.js ***!\n \\***************************************************/\n/***/ (function(__unused_webpack_module, exports, __webpack_require__) {\n\n\"use strict\";\n/* eslint-disable */\n\n\n\n/*\n TraceKit - Cross browser stack traces - github.com/occ/TraceKit\n\n This was originally forked from github.com/occ/TraceKit, but has since been\n largely re-written and is now maintained as part of raven-js. Tests for\n this are in test/vendor.\n\n MIT license\n*/\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\nvar TraceKit = {\n collectWindowErrors: true,\n debug: false\n};\n\n// This is to be defensive in environments where window does not exist (see https://github.com/getsentry/raven-js/pull/785)\nvar _window = typeof window !== 'undefined' ? window : typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g : typeof self !== 'undefined' ? self : {};\n\n// global reference to slice\nvar _slice = [].slice;\nvar UNKNOWN_FUNCTION = '?';\n\n// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#Error_types\nvar ERROR_TYPES_RE = /^(?:Uncaught (?:exception: )?)?((?:Eval|Internal|Range|Reference|Syntax|Type|URI)Error): ?(.*)$/;\nfunction getLocationHref() {\n if (typeof document === 'undefined' || typeof document.location === 'undefined') return '';\n return document.location.href;\n}\n\n/**\n * TraceKit.report: cross-browser processing of unhandled exceptions\n *\n * Syntax:\n * TraceKit.report.subscribe(function(stackInfo) { ... })\n * TraceKit.report.unsubscribe(function(stackInfo) { ... })\n * TraceKit.report(exception)\n * try { ...code... } catch(ex) { TraceKit.report(ex); }\n *\n * Supports:\n * - Firefox: full stack trace with line numbers, plus column number\n * on top frame; column number is not guaranteed\n * - Opera: full stack trace with line and column numbers\n * - Chrome: full stack trace with line and column numbers\n * - Safari: line and column number for the top frame only; some frames\n * may be missing, and column number is not guaranteed\n * - IE: line and column number for the top frame only; some frames\n * may be missing, and column number is not guaranteed\n *\n * In theory, TraceKit should work on all of the following versions:\n * - IE5.5+ (only 8.0 tested)\n * - Firefox 0.9+ (only 3.5+ tested)\n * - Opera 7+ (only 10.50 tested; versions 9 and earlier may require\n * Exceptions Have Stacktrace to be enabled in opera:config)\n * - Safari 3+ (only 4+ tested)\n * - Chrome 1+ (only 5+ tested)\n * - Konqueror 3.5+ (untested)\n *\n * Requires TraceKit.computeStackTrace.\n *\n * Tries to catch all unhandled exceptions and report them to the\n * subscribed handlers. Please note that TraceKit.report will rethrow the\n * exception. This is REQUIRED in order to get a useful stack trace in IE.\n * If the exception does not reach the top of the browser, you will only\n * get a stack trace from the point where TraceKit.report was called.\n *\n * Handlers receive a stackInfo object as described in the\n * TraceKit.computeStackTrace docs.\n */\nTraceKit.report = function reportModuleWrapper() {\n var handlers = [],\n lastArgs = null,\n lastException = null,\n lastExceptionStack = null;\n\n /**\n * Add a crash handler.\n * @param {Function} handler\n */\n function subscribe(handler) {\n installGlobalHandler();\n handlers.push(handler);\n }\n\n /**\n * Remove a crash handler.\n * @param {Function} handler\n */\n function unsubscribe(handler) {\n for (var i = handlers.length - 1; i >= 0; --i) {\n if (handlers[i] === handler) {\n handlers.splice(i, 1);\n }\n }\n }\n\n /**\n * Remove all crash handlers.\n */\n function unsubscribeAll() {\n uninstallGlobalHandler();\n handlers = [];\n }\n\n /**\n * Dispatch stack information to all handlers.\n * @param {Object.} stack\n */\n function notifyHandlers(stack, isWindowError) {\n var exception = null;\n if (isWindowError && !TraceKit.collectWindowErrors) {\n return;\n }\n for (var i in handlers) {\n if (handlers.hasOwnProperty(i)) {\n try {\n handlers[i].apply(null, [stack].concat(_slice.call(arguments, 2)));\n } catch (inner) {\n exception = inner;\n }\n }\n }\n if (exception) {\n throw exception;\n }\n }\n var _oldOnerrorHandler, _onErrorHandlerInstalled;\n\n /**\n * Ensures all global unhandled exceptions are recorded.\n * Supported by Gecko and IE.\n * @param {string} message Error message.\n * @param {string} url URL of script that generated the exception.\n * @param {(number|string)} lineNo The line number at which the error\n * occurred.\n * @param {?(number|string)} colNo The column number at which the error\n * occurred.\n * @param {?Error} ex The actual Error object.\n */\n function traceKitWindowOnError(message, url, lineNo, colNo, ex) {\n var stack = null;\n if (lastExceptionStack) {\n TraceKit.computeStackTrace.augmentStackTraceWithInitialElement(lastExceptionStack, url, lineNo, message);\n processLastException();\n } else if (ex) {\n // New chrome and blink send along a real error object\n // Let's just report that like a normal error.\n // See: https://mikewest.org/2013/08/debugging-runtime-errors-with-window-onerror\n stack = TraceKit.computeStackTrace(ex);\n notifyHandlers(stack, true);\n } else {\n var location = {\n 'url': url,\n 'line': lineNo,\n 'column': colNo\n };\n var name = undefined;\n var msg = message; // must be new var or will modify original `arguments`\n var groups;\n if ({}.toString.call(message) === '[object String]') {\n var groups = message.match(ERROR_TYPES_RE);\n if (groups) {\n name = groups[1];\n msg = groups[2];\n }\n }\n location.func = UNKNOWN_FUNCTION;\n stack = {\n 'name': name,\n 'message': msg,\n 'url': getLocationHref(),\n 'stack': [location]\n };\n notifyHandlers(stack, true);\n }\n if (_oldOnerrorHandler) {\n return _oldOnerrorHandler.apply(this, arguments);\n }\n return false;\n }\n function installGlobalHandler() {\n if (_onErrorHandlerInstalled) {\n return;\n }\n _oldOnerrorHandler = _window.onerror;\n _window.onerror = traceKitWindowOnError;\n _onErrorHandlerInstalled = true;\n }\n function uninstallGlobalHandler() {\n if (!_onErrorHandlerInstalled) {\n return;\n }\n _window.onerror = _oldOnerrorHandler;\n _onErrorHandlerInstalled = false;\n _oldOnerrorHandler = undefined;\n }\n function processLastException() {\n var _lastExceptionStack = lastExceptionStack,\n _lastArgs = lastArgs;\n lastArgs = null;\n lastExceptionStack = null;\n lastException = null;\n notifyHandlers.apply(null, [_lastExceptionStack, false].concat(_lastArgs));\n }\n\n /**\n * Reports an unhandled Error to TraceKit.\n * @param {Error} ex\n * @param {?boolean} rethrow If false, do not re-throw the exception.\n * Only used for window.onerror to not cause an infinite loop of\n * rethrowing.\n */\n function report(ex, rethrow) {\n var args = _slice.call(arguments, 1);\n if (lastExceptionStack) {\n if (lastException === ex) {\n return; // already caught by an inner catch block, ignore\n } else {\n processLastException();\n }\n }\n var stack = TraceKit.computeStackTrace(ex);\n lastExceptionStack = stack;\n lastException = ex;\n lastArgs = args;\n\n // If the stack trace is incomplete, wait for 2 seconds for\n // slow slow IE to see if onerror occurs or not before reporting\n // this exception; otherwise, we will end up with an incomplete\n // stack trace\n setTimeout(function () {\n if (lastException === ex) {\n processLastException();\n }\n }, stack.incomplete ? 2000 : 0);\n if (rethrow !== false) {\n throw ex; // re-throw to propagate to the top level (and cause window.onerror)\n }\n }\n\n report.subscribe = subscribe;\n report.unsubscribe = unsubscribe;\n report.uninstall = unsubscribeAll;\n return report;\n}();\n\n/**\n * TraceKit.computeStackTrace: cross-browser stack traces in JavaScript\n *\n * Syntax:\n * s = TraceKit.computeStackTrace(exception) // consider using TraceKit.report instead (see below)\n * Returns:\n * s.name - exception name\n * s.message - exception message\n * s.stack[i].url - JavaScript or HTML file URL\n * s.stack[i].func - function name, or empty for anonymous functions (if guessing did not work)\n * s.stack[i].args - arguments passed to the function, if known\n * s.stack[i].line - line number, if known\n * s.stack[i].column - column number, if known\n *\n * Supports:\n * - Firefox: full stack trace with line numbers and unreliable column\n * number on top frame\n * - Opera 10: full stack trace with line and column numbers\n * - Opera 9-: full stack trace with line numbers\n * - Chrome: full stack trace with line and column numbers\n * - Safari: line and column number for the topmost stacktrace element\n * only\n * - IE: no line numbers whatsoever\n *\n * Tries to guess names of anonymous functions by looking for assignments\n * in the source code. In IE and Safari, we have to guess source file names\n * by searching for function bodies inside all page scripts. This will not\n * work for scripts that are loaded cross-domain.\n * Here be dragons: some function names may be guessed incorrectly, and\n * duplicate functions may be mismatched.\n *\n * TraceKit.computeStackTrace should only be used for tracing purposes.\n * Logging of unhandled exceptions should be done with TraceKit.report,\n * which builds on top of TraceKit.computeStackTrace and provides better\n * IE support by utilizing the window.onerror event to retrieve information\n * about the top of the stack.\n *\n * Note: In IE and Safari, no stack trace is recorded on the Error object,\n * so computeStackTrace instead walks its *own* chain of callers.\n * This means that:\n * * in Safari, some methods may be missing from the stack trace;\n * * in IE, the topmost function in the stack trace will always be the\n * caller of computeStackTrace.\n *\n * This is okay for tracing (because you are likely to be calling\n * computeStackTrace from the function you want to be the topmost element\n * of the stack trace anyway), but not okay for logging unhandled\n * exceptions (because your catch block will likely be far away from the\n * inner function that actually caused the exception).\n *\n */\nTraceKit.computeStackTrace = function computeStackTraceWrapper() {\n /**\n * Escapes special characters, except for whitespace, in a string to be\n * used inside a regular expression as a string literal.\n * @param {string} text The string.\n * @return {string} The escaped string literal.\n */\n function escapeRegExp(text) {\n return text.replace(/[\\-\\[\\]{}()*+?.,\\\\\\^$|#]/g, '\\\\$&');\n }\n\n /**\n * Escapes special characters in a string to be used inside a regular\n * expression as a string literal. Also ensures that HTML entities will\n * be matched the same as their literal friends.\n * @param {string} body The string.\n * @return {string} The escaped string.\n */\n function escapeCodeAsRegExpForMatchingInsideHTML(body) {\n return escapeRegExp(body).replace('<', '(?:<|<)').replace('>', '(?:>|>)').replace('&', '(?:&|&)').replace('\"', '(?:\"|")').replace(/\\s+/g, '\\\\s+');\n }\n\n // Contents of Exception in various browsers.\n //\n // SAFARI:\n // ex.message = Can't find variable: qq\n // ex.line = 59\n // ex.sourceId = 580238192\n // ex.sourceURL = http://...\n // ex.expressionBeginOffset = 96\n // ex.expressionCaretOffset = 98\n // ex.expressionEndOffset = 98\n // ex.name = ReferenceError\n //\n // FIREFOX:\n // ex.message = qq is not defined\n // ex.fileName = http://...\n // ex.lineNumber = 59\n // ex.columnNumber = 69\n // ex.stack = ...stack trace... (see the example below)\n // ex.name = ReferenceError\n //\n // CHROME:\n // ex.message = qq is not defined\n // ex.name = ReferenceError\n // ex.type = not_defined\n // ex.arguments = ['aa']\n // ex.stack = ...stack trace...\n //\n // INTERNET EXPLORER:\n // ex.message = ...\n // ex.name = ReferenceError\n //\n // OPERA:\n // ex.message = ...message... (see the example below)\n // ex.name = ReferenceError\n // ex.opera#sourceloc = 11 (pretty much useless, duplicates the info in ex.message)\n // ex.stacktrace = n/a; see 'opera:config#UserPrefs|Exceptions Have Stacktrace'\n\n /**\n * Computes stack trace information from the stack property.\n * Chrome and Gecko use this property.\n * @param {Error} ex\n * @return {?Object.} Stack trace information.\n */\n function computeStackTraceFromStackProp(ex) {\n if (typeof ex.stack === 'undefined' || !ex.stack) return;\n var chrome = /^\\s*at (.*?) ?\\(((?:file|https?|blob|chrome-extension|native|eval|).*?)(?::(\\d+))?(?::(\\d+))?\\)?\\s*$/i,\n gecko = /^\\s*(.*?)(?:\\((.*?)\\))?(?:^|@)((?:file|https?|blob|chrome|resource|\\[native).*?)(?::(\\d+))?(?::(\\d+))?\\s*$/i,\n winjs = /^\\s*at (?:((?:\\[object object\\])?.+) )?\\(?((?:file|ms-appx|https?|blob):.*?):(\\d+)(?::(\\d+))?\\)?\\s*$/i,\n lines = ex.stack.split('\\n'),\n stack = [],\n parts,\n element,\n reference = /^(.*) is undefined$/.exec(ex.message);\n for (var i = 0, j = lines.length; i < j; ++i) {\n if (parts = chrome.exec(lines[i])) {\n var isNative = parts[2] && parts[2].indexOf('native') !== -1;\n element = {\n 'url': !isNative ? parts[2] : null,\n 'func': parts[1] || UNKNOWN_FUNCTION,\n 'args': isNative ? [parts[2]] : [],\n 'line': parts[3] ? +parts[3] : null,\n 'column': parts[4] ? +parts[4] : null\n };\n } else if (parts = winjs.exec(lines[i])) {\n element = {\n 'url': parts[2],\n 'func': parts[1] || UNKNOWN_FUNCTION,\n 'args': [],\n 'line': +parts[3],\n 'column': parts[4] ? +parts[4] : null\n };\n } else if (parts = gecko.exec(lines[i])) {\n element = {\n 'url': parts[3],\n 'func': parts[1] || UNKNOWN_FUNCTION,\n 'args': parts[2] ? parts[2].split(',') : [],\n 'line': parts[4] ? +parts[4] : null,\n 'column': parts[5] ? +parts[5] : null\n };\n } else {\n continue;\n }\n if (!element.func && element.line) {\n element.func = UNKNOWN_FUNCTION;\n }\n stack.push(element);\n }\n if (!stack.length) {\n return null;\n }\n if (!stack[0].column && typeof ex.columnNumber !== 'undefined') {\n // FireFox uses this awesome columnNumber property for its top frame\n // Also note, Firefox's column number is 0-based and everything else expects 1-based,\n // so adding 1\n stack[0].column = ex.columnNumber + 1;\n }\n return {\n 'name': ex.name,\n 'message': ex.message,\n 'url': getLocationHref(),\n 'stack': stack\n };\n }\n\n /**\n * Adds information about the first frame to incomplete stack traces.\n * Safari and IE require this to get complete data on the first frame.\n * @param {Object.} stackInfo Stack trace information from\n * one of the compute* methods.\n * @param {string} url The URL of the script that caused an error.\n * @param {(number|string)} lineNo The line number of the script that\n * caused an error.\n * @param {string=} message The error generated by the browser, which\n * hopefully contains the name of the object that caused the error.\n * @return {boolean} Whether or not the stack information was\n * augmented.\n */\n function augmentStackTraceWithInitialElement(stackInfo, url, lineNo, message) {\n var initial = {\n 'url': url,\n 'line': lineNo\n };\n if (initial.url && initial.line) {\n stackInfo.incomplete = false;\n if (!initial.func) {\n initial.func = UNKNOWN_FUNCTION;\n }\n if (stackInfo.stack.length > 0) {\n if (stackInfo.stack[0].url === initial.url) {\n if (stackInfo.stack[0].line === initial.line) {\n return false; // already in stack trace\n } else if (!stackInfo.stack[0].line && stackInfo.stack[0].func === initial.func) {\n stackInfo.stack[0].line = initial.line;\n return false;\n }\n }\n }\n stackInfo.stack.unshift(initial);\n stackInfo.partial = true;\n return true;\n } else {\n stackInfo.incomplete = true;\n }\n return false;\n }\n\n /**\n * Computes stack trace information by walking the arguments.caller\n * chain at the time the exception occurred. This will cause earlier\n * frames to be missed but is the only way to get any stack trace in\n * Safari and IE. The top frame is restored by\n * {@link augmentStackTraceWithInitialElement}.\n * @param {Error} ex\n * @return {?Object.} Stack trace information.\n */\n function computeStackTraceByWalkingCallerChain(ex, depth) {\n var functionName = /function\\s+([_$a-zA-Z\\xA0-\\uFFFF][_$a-zA-Z0-9\\xA0-\\uFFFF]*)?\\s*\\(/i,\n stack = [],\n funcs = {},\n recursion = false,\n parts,\n item,\n source;\n for (var curr = computeStackTraceByWalkingCallerChain.caller; curr && !recursion; curr = curr.caller) {\n if (curr === computeStackTrace || curr === TraceKit.report) {\n // console.log('skipping internal function');\n continue;\n }\n item = {\n 'url': null,\n 'func': UNKNOWN_FUNCTION,\n 'line': null,\n 'column': null\n };\n if (curr.name) {\n item.func = curr.name;\n } else if (parts = functionName.exec(curr.toString())) {\n item.func = parts[1];\n }\n if (typeof item.func === 'undefined') {\n try {\n item.func = parts.input.substring(0, parts.input.indexOf('{'));\n } catch (e) {}\n }\n if (funcs['' + curr]) {\n recursion = true;\n } else {\n funcs['' + curr] = true;\n }\n stack.push(item);\n }\n if (depth) {\n // console.log('depth is ' + depth);\n // console.log('stack is ' + stack.length);\n stack.splice(0, depth);\n }\n var result = {\n 'name': ex.name,\n 'message': ex.message,\n 'url': getLocationHref(),\n 'stack': stack\n };\n augmentStackTraceWithInitialElement(result, ex.sourceURL || ex.fileName, ex.line || ex.lineNumber, ex.message || ex.description);\n return result;\n }\n\n /**\n * Computes a stack trace for an exception.\n * @param {Error} ex\n * @param {(string|number)=} depth\n */\n function computeStackTrace(ex, depth) {\n var stack = null;\n depth = depth == null ? 0 : +depth;\n try {\n stack = computeStackTraceFromStackProp(ex);\n if (stack) {\n return stack;\n }\n } catch (e) {\n if (TraceKit.debug) {\n throw e;\n }\n }\n try {\n stack = computeStackTraceByWalkingCallerChain(ex, depth + 1);\n if (stack) {\n return stack;\n }\n } catch (e) {\n if (TraceKit.debug) {\n throw e;\n }\n }\n return {\n 'name': ex.name,\n 'message': ex.message,\n 'url': getLocationHref()\n };\n }\n computeStackTrace.augmentStackTraceWithInitialElement = augmentStackTraceWithInitialElement;\n computeStackTrace.computeStackTraceFromStackProp = computeStackTraceFromStackProp;\n return computeStackTrace;\n}();\nvar _default = TraceKit;\nexports[\"default\"] = _default;\n\n/***/ }),\n\n/***/ \"./packages/@logrocket/utils/src/constants/nps.js\":\n/*!********************************************************!*\\\n !*** ./packages/@logrocket/utils/src/constants/nps.js ***!\n \\********************************************************/\n/***/ (function(__unused_webpack_module, exports) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports.DELIGHTED_FEEDBACK_PREFIX = exports.DELIGHTED_RESPONSES_REGEX = exports.WOOTRIC_RESPONSES_REGEX = void 0;\nvar WOOTRIC_RESPONSES_REGEX = /^https:\\/\\/production.wootric.com\\/responses/;\nexports.WOOTRIC_RESPONSES_REGEX = WOOTRIC_RESPONSES_REGEX;\nvar DELIGHTED_RESPONSES_REGEX = /^https:\\/\\/web.delighted.com\\/e\\/[a-zA-Z-]*\\/c/;\nexports.DELIGHTED_RESPONSES_REGEX = DELIGHTED_RESPONSES_REGEX;\nvar DELIGHTED_FEEDBACK_PREFIX = 'comment=';\nexports.DELIGHTED_FEEDBACK_PREFIX = DELIGHTED_FEEDBACK_PREFIX;\n\n/***/ }),\n\n/***/ \"./packages/@logrocket/utils/src/enhanceFunc.ts\":\n/*!******************************************************!*\\\n !*** ./packages/@logrocket/utils/src/enhanceFunc.ts ***!\n \\******************************************************/\n/***/ (function(__unused_webpack_module, exports) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = enhanceFunc;\nvar NO_OP_UNREGISTER = function NO_OP_UNREGISTER() {};\nfunction enhanceFunc(obj, method, handler) {\n if (typeof obj[method] !== 'function') {\n return NO_OP_UNREGISTER;\n }\n try {\n // eslint-disable-next-line no-inner-declarations\n var shim = function shim() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n var res = original.apply(this, args);\n handler.apply(this, args);\n return res;\n }; // eslint-disable-next-line no-param-reassign\n var original = obj[method];\n obj[method] = shim;\n return function () {\n // eslint-disable-next-line no-param-reassign\n obj[method] = original;\n };\n } catch (_error) {\n return NO_OP_UNREGISTER;\n }\n}\n\n/***/ }),\n\n/***/ \"./packages/@logrocket/utils/src/logError.js\":\n/*!***************************************************!*\\\n !*** ./packages/@logrocket/utils/src/logError.js ***!\n \\***************************************************/\n/***/ (function(__unused_webpack_module, exports) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\nvar canBind = typeof console !== 'undefined' && console.error && console.error.bind;\nvar logError = canBind ? console.error.bind(console) : function () {};\nvar _default = logError;\nexports[\"default\"] = _default;\n\n/***/ }),\n\n/***/ \"./packages/@logrocket/utils/src/mapValues.js\":\n/*!****************************************************!*\\\n !*** ./packages/@logrocket/utils/src/mapValues.js ***!\n \\****************************************************/\n/***/ (function(__unused_webpack_module, exports) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = mapValues;\nfunction mapValues(obj, f) {\n if (obj == null) {\n return {};\n }\n var res = {};\n Object.keys(obj).forEach(function (key) {\n res[key] = f(obj[key]);\n });\n return res;\n}\n\n/***/ }),\n\n/***/ \"./packages/@logrocket/utils/src/protectFunc.js\":\n/*!******************************************************!*\\\n !*** ./packages/@logrocket/utils/src/protectFunc.js ***!\n \\******************************************************/\n/***/ (function(__unused_webpack_module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ \"./node_modules/@babel/runtime/helpers/interopRequireDefault.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = protectFunc;\nvar _sendTelemetryData = _interopRequireDefault(__webpack_require__(/*! ./sendTelemetryData */ \"./packages/@logrocket/utils/src/sendTelemetryData.js\"));\nvar _logError = _interopRequireDefault(__webpack_require__(/*! ./logError */ \"./packages/@logrocket/utils/src/logError.js\"));\nfunction protectFunc(f) {\n var onFail = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {};\n return function () {\n var result;\n try {\n result = f.apply(void 0, arguments);\n } catch (err) {\n if (typeof window !== 'undefined' && window._lrdebug) {\n throw err;\n }\n var payload = onFail(err);\n (0, _logError.default)('LogRocket', err);\n (0, _sendTelemetryData.default)(err, payload);\n }\n return result;\n };\n}\n\n/***/ }),\n\n/***/ \"./packages/@logrocket/utils/src/scrubException.ts\":\n/*!*********************************************************!*\\\n !*** ./packages/@logrocket/utils/src/scrubException.ts ***!\n \\*********************************************************/\n/***/ (function(__unused_webpack_module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ \"./node_modules/@babel/runtime/helpers/interopRequireDefault.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports.scrubException = scrubException;\nvar _typeof2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/typeof */ \"./node_modules/@babel/runtime/helpers/typeof.js\"));\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\nfunction isScalar(value) {\n return /boolean|number|string/.test((0, _typeof2.default)(value));\n}\nvar optionalScalars = [\n// Valid values for 'level' are 'fatal', 'error', 'warning', 'info',\n// and 'debug'. Defaults to 'error'.\n'level', 'logger'];\nvar optionalMaps = ['tags', 'extra'];\nfunction scrubException(data, options) {\n if (options) {\n var _iterator = _createForOfIteratorHelper(optionalScalars),\n _step;\n try {\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n var field = _step.value;\n var value = options[field];\n if (isScalar(value)) {\n // eslint-disable-next-line no-param-reassign\n data[field] = value.toString();\n }\n }\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n var _iterator2 = _createForOfIteratorHelper(optionalMaps),\n _step2;\n try {\n for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {\n var _field = _step2.value;\n var dirty = options[_field] || {};\n var scrubbed = {};\n for (var _i = 0, _Object$keys = Object.keys(dirty); _i < _Object$keys.length; _i++) {\n var key = _Object$keys[_i];\n var _value = dirty[key];\n if (isScalar(_value)) {\n scrubbed[key.toString()] = _value.toString();\n }\n }\n\n // eslint-disable-next-line no-param-reassign\n data[_field] = scrubbed;\n }\n } catch (err) {\n _iterator2.e(err);\n } finally {\n _iterator2.f();\n }\n }\n}\n\n/***/ }),\n\n/***/ \"./packages/@logrocket/utils/src/sendTelemetryData.js\":\n/*!************************************************************!*\\\n !*** ./packages/@logrocket/utils/src/sendTelemetryData.js ***!\n \\************************************************************/\n/***/ (function(__unused_webpack_module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ \"./node_modules/@babel/runtime/helpers/interopRequireDefault.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports.sendTelemetry = sendTelemetry;\nexports[\"default\"] = sendErrorTelemetry;\nvar _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ \"./node_modules/@babel/runtime/helpers/defineProperty.js\"));\nvar _logError = _interopRequireDefault(__webpack_require__(/*! ./logError */ \"./packages/@logrocket/utils/src/logError.js\"));\nvar _TraceKit = _interopRequireDefault(__webpack_require__(/*! ./TraceKit */ \"./packages/@logrocket/utils/src/TraceKit.js\"));\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\n// eslint-disable-next-line no-undef\nvar SCRIPT_VERSION = true ? \"6bac45321383b111ea7b5f5d47ea35c25bf967dc\" : 0;\nfunction _sendToSentry(data) {\n var XHR = window._lrXMLHttpRequest || XMLHttpRequest;\n try {\n var _window, _window$__SDKCONFIG__;\n var req = new XHR();\n var message = data.message;\n var url = 'https://e.logrocket.com/api/3/store/?sentry_version=7&sentry_client=http%2F3.8.0&sentry_key=b64162b4187a4c5caae8a68a7e291793';\n req.open('POST', url);\n req.send(JSON.stringify(_objectSpread({\n message: message,\n logger: 'javascript',\n platform: 'javascript',\n request: {\n headers: {\n 'User-Agent': typeof navigator !== 'undefined' && navigator.userAgent\n },\n url: typeof location !== 'undefined' && location.href\n },\n release: SCRIPT_VERSION,\n environment: ((_window = window) === null || _window === void 0 ? void 0 : (_window$__SDKCONFIG__ = _window.__SDKCONFIG__) === null || _window$__SDKCONFIG__ === void 0 ? void 0 : _window$__SDKCONFIG__.scriptEnv) || 'prod'\n }, data)));\n } catch (err) {\n (0, _logError.default)('Failed to send', err);\n }\n}\nfunction sendTelemetry(message, more) {\n if (typeof window !== 'undefined' && window._lrdebug) {\n return void (0, _logError.default)(message);\n }\n if (more && more.extra && more.extra.appID && typeof more.extra.appID.indexOf === 'function' && more.extra.appID.indexOf('au2drp/') === 0 && Math.random() >= 0.25) {\n return;\n }\n _sendToSentry(_objectSpread({\n message: message\n }, more));\n}\nfunction sendErrorTelemetry(err, payload) {\n try {\n var message = err.message;\n var stringPayload;\n try {\n stringPayload = JSON.stringify(payload).slice(0, 1000);\n } catch (err) {\n try {\n stringPayload = \"Could not stringify payload: \".concat(Object.prototype.toString.call(payload));\n } catch (err) {/* nada */}\n }\n var stack;\n try {\n stack = _TraceKit.default.computeStackTrace(err).stack.map(function (frame) {\n return {\n filename: frame.url,\n lineno: frame.line,\n colno: frame.column,\n function: frame.func || '?'\n };\n });\n } catch (err) {\n /* nada */\n }\n _sendToSentry({\n message: message,\n extra: {\n stringPayload: stringPayload\n },\n exception: {\n values: [{\n type: err.type,\n value: message,\n stacktrace: {\n frames: stack\n }\n }]\n }\n });\n } catch (err) {\n (0, _logError.default)('Failed to send', err);\n }\n}\n\n/***/ }),\n\n/***/ \"./packages/@logrocket/utils/src/startsWith.js\":\n/*!*****************************************************!*\\\n !*** ./packages/@logrocket/utils/src/startsWith.js ***!\n \\*****************************************************/\n/***/ (function(__unused_webpack_module, exports) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = startsWith;\nfunction startsWith(value, search) {\n var pos = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;\n return value && search && value.substring(pos, pos + search.length) === search;\n}\n\n/***/ }),\n\n/***/ \"./packages/logrocket/src/LogRocket.js\":\n/*!*********************************************!*\\\n !*** ./packages/logrocket/src/LogRocket.js ***!\n \\*********************************************/\n/***/ (function(__unused_webpack_module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ \"./node_modules/@babel/runtime/helpers/interopRequireDefault.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = exports.MAX_QUEUE_SIZE = void 0;\nvar _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ \"./node_modules/@babel/runtime/helpers/classCallCheck.js\"));\nvar _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ \"./node_modules/@babel/runtime/helpers/createClass.js\"));\nvar _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ \"./node_modules/@babel/runtime/helpers/defineProperty.js\"));\nvar _objectWithoutProperties2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/objectWithoutProperties */ \"./node_modules/@babel/runtime/helpers/objectWithoutProperties.js\"));\nvar _network = _interopRequireDefault(__webpack_require__(/*! @logrocket/network */ \"./packages/@logrocket/network/src/index.js\"));\nvar _exceptions = __webpack_require__(/*! @logrocket/exceptions */ \"./packages/@logrocket/exceptions/src/index.js\");\nvar _console = _interopRequireDefault(__webpack_require__(/*! @logrocket/console */ \"./packages/@logrocket/console/src/index.js\"));\nvar _redux = __webpack_require__(/*! @logrocket/redux */ \"./packages/@logrocket/redux/src/index.js\");\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nvar MAX_QUEUE_SIZE = 1000;\nexports.MAX_QUEUE_SIZE = MAX_QUEUE_SIZE;\nvar considerIngestServerOption = function considerIngestServerOption() {\n var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n ingestServer = _ref.ingestServer,\n options = (0, _objectWithoutProperties2.default)(_ref, [\"ingestServer\"]);\n if (ingestServer) {\n return _objectSpread({\n serverURL: \"\".concat(ingestServer, \"/i\"),\n statsURL: \"\".concat(ingestServer, \"/s\")\n }, options);\n }\n return options;\n};\nvar LogRocket = /*#__PURE__*/function () {\n function LogRocket() {\n var _this = this;\n (0, _classCallCheck2.default)(this, LogRocket);\n this._buffer = [];\n // TODO: tests for these exposed methods.\n ['log', 'info', 'warn', 'error', 'debug'].forEach(function (method) {\n _this[method] = function () {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n _this.addEvent('lr.core.LogEvent', function () {\n var consoleOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n if (method === 'error' && consoleOptions.shouldAggregateConsoleErrors) {\n _exceptions.Capture.captureMessage(_this, args[0], args, {}, true);\n }\n return {\n logLevel: method.toUpperCase(),\n args: args\n };\n }, {\n shouldCaptureStackTrace: true\n });\n };\n });\n this._isInitialized = false;\n this._installed = [];\n\n // expose a callback to get the session URL from the global context\n window._lr_surl_cb = this.getSessionURL.bind(this);\n }\n (0, _createClass2.default)(LogRocket, [{\n key: \"addEvent\",\n value: function addEvent(type, getMessage) {\n var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var time = Date.now();\n this._run(function (logger) {\n logger.addEvent(type, getMessage, _objectSpread(_objectSpread({}, opts), {}, {\n timeOverride: time\n }));\n });\n }\n }, {\n key: \"onLogger\",\n value: function onLogger(logger) {\n this._logger = logger;\n while (this._buffer.length > 0) {\n var f = this._buffer.shift();\n f(this._logger);\n }\n }\n }, {\n key: \"_run\",\n value: function _run(f) {\n if (this._isDisabled) {\n return;\n }\n if (this._logger) {\n f(this._logger);\n } else {\n if (this._buffer.length >= MAX_QUEUE_SIZE) {\n this._isDisabled = true;\n console.warn('LogRocket: script did not load. Check that you have a valid network connection.');\n this.uninstall();\n return;\n }\n this._buffer.push(f.bind(this));\n }\n }\n }, {\n key: \"init\",\n value: function init(appID) {\n var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n if (!this._isInitialized) {\n var _opts$network;\n var _opts$shouldAugmentNP = opts.shouldAugmentNPS,\n shouldAugmentNPS = _opts$shouldAugmentNP === void 0 ? true : _opts$shouldAugmentNP,\n _opts$shouldParseXHRB = opts.shouldParseXHRBlob,\n shouldParseXHRBlob = _opts$shouldParseXHRB === void 0 ? false : _opts$shouldParseXHRB,\n _opts$shouldDetectExc = opts.shouldDetectExceptions,\n shouldDetectExceptions = _opts$shouldDetectExc === void 0 ? true : _opts$shouldDetectExc;\n if (shouldDetectExceptions) {\n this._installed.push((0, _exceptions.registerExceptions)(this));\n }\n this._installed.push((0, _network.default)(this, {\n shouldAugmentNPS: !!shouldAugmentNPS,\n shouldParseXHRBlob: !!shouldParseXHRBlob,\n isDisabled: (opts === null || opts === void 0 ? void 0 : (_opts$network = opts.network) === null || _opts$network === void 0 ? void 0 : _opts$network.isEnabled) === false\n }));\n this._installed.push((0, _console.default)(this));\n this._isInitialized = true;\n this._run(function (logger) {\n logger.init(appID, considerIngestServerOption(opts));\n });\n }\n }\n }, {\n key: \"start\",\n value: function start() {\n this._run(function (logger) {\n logger.start();\n });\n }\n }, {\n key: \"uninstall\",\n value: function uninstall() {\n this._installed.forEach(function (f) {\n return f();\n });\n this._buffer = [];\n this._run(function (logger) {\n logger.uninstall();\n });\n }\n }, {\n key: \"identify\",\n value: function identify(id, opts) {\n this._run(function (logger) {\n logger.identify(id, opts);\n });\n }\n }, {\n key: \"startNewSession\",\n value: function startNewSession() {\n this._run(function (logger) {\n logger.startNewSession();\n });\n }\n }, {\n key: \"track\",\n value: function track(customEventName, eventProperties) {\n this._run(function (logger) {\n logger.track(customEventName, eventProperties);\n });\n }\n }, {\n key: \"getSessionURL\",\n value: function getSessionURL(cb) {\n if (typeof cb !== 'function') {\n throw new Error('LogRocket: must pass callback to getSessionURL()');\n }\n this._run(function (logger) {\n if (logger.getSessionURL) {\n logger.getSessionURL(cb);\n } else {\n cb(logger.recordingURL);\n }\n });\n }\n }, {\n key: \"trackScrollEvent\",\n value: function trackScrollEvent(target) {\n // Only reigster the event if the core logger is available,\n // otherwise we won't yet have captured the target element:\n if (this._logger) {\n this._logger.trackScrollEvent(target);\n }\n }\n }, {\n key: \"getVersion\",\n value: function getVersion(cb) {\n this._run(function (logger) {\n cb(logger.version);\n });\n }\n }, {\n key: \"captureMessage\",\n value: function captureMessage(message) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n _exceptions.Capture.captureMessage(this, message, [message], options);\n }\n }, {\n key: \"captureException\",\n value: function captureException(exception) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n _exceptions.Capture.captureException(this, exception, options);\n }\n }, {\n key: \"version\",\n get: function get() {\n return this._logger && this._logger.version;\n }\n }, {\n key: \"sessionURL\",\n get: function get() {\n return this._logger && this._logger.recordingURL;\n }\n }, {\n key: \"recordingURL\",\n get: function get() {\n return this._logger && this._logger.recordingURL;\n }\n }, {\n key: \"recordingID\",\n get: function get() {\n return this._logger && this._logger.recordingID;\n }\n }, {\n key: \"threadID\",\n get: function get() {\n return this._logger && this._logger.threadID;\n }\n }, {\n key: \"tabID\",\n get: function get() {\n return this._logger && this._logger.tabID;\n }\n }, {\n key: \"reduxEnhancer\",\n value: function reduxEnhancer() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return (0, _redux.createEnhancer)(this, options);\n }\n }, {\n key: \"reduxMiddleware\",\n value: function reduxMiddleware() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return (0, _redux.createMiddleware)(this, options);\n }\n }, {\n key: \"isDisabled\",\n get: function get() {\n return !!(this._isDisabled || this._logger && this._logger._isDisabled);\n }\n }]);\n return LogRocket;\n}();\nexports[\"default\"] = LogRocket;\n\n/***/ }),\n\n/***/ \"./packages/logrocket/src/makeLogRocket.js\":\n/*!*************************************************!*\\\n !*** ./packages/logrocket/src/makeLogRocket.js ***!\n \\*************************************************/\n/***/ (function(__unused_webpack_module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ \"./node_modules/@babel/runtime/helpers/interopRequireDefault.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = makeLogRocket;\nvar _LogRocket = _interopRequireDefault(__webpack_require__(/*! ./LogRocket */ \"./packages/logrocket/src/LogRocket.js\"));\nvar REACT_NATIVE_NOTICE = 'LogRocket on React Native requires the LogRocket React Native specific SDK. See setup guide here https://docs.logrocket.com/reference/react-native.';\nvar makeNoopPolyfill = function makeNoopPolyfill() {\n return {\n init: function init() {},\n uninstall: function uninstall() {},\n log: function log() {},\n info: function info() {},\n warn: function warn() {},\n error: function error() {},\n debug: function debug() {},\n addEvent: function addEvent() {},\n identify: function identify() {},\n start: function start() {},\n get threadID() {\n return null;\n },\n get recordingID() {\n return null;\n },\n get recordingURL() {\n return null;\n },\n reduxEnhancer: function reduxEnhancer() {\n return function (store) {\n return function () {\n return store.apply(void 0, arguments);\n };\n };\n },\n reduxMiddleware: function reduxMiddleware() {\n return function () {\n return function (next) {\n return function (action) {\n return next(action);\n };\n };\n };\n },\n track: function track() {},\n getSessionURL: function getSessionURL() {},\n getVersion: function getVersion() {},\n startNewSession: function startNewSession() {},\n onLogger: function onLogger() {},\n setClock: function setClock() {},\n captureMessage: function captureMessage() {},\n captureException: function captureException() {}\n };\n};\nfunction makeLogRocket() {\n var getLogger = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {};\n if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {\n throw new Error(REACT_NATIVE_NOTICE);\n }\n if (typeof window !== 'undefined') {\n if (window._disableLogRocket) {\n return makeNoopPolyfill();\n }\n if (window.MutationObserver && window.WeakMap) {\n // Save window globals that we rely on.\n window._lrMutationObserver = window.MutationObserver;\n var instance = new _LogRocket.default();\n getLogger(instance);\n return instance;\n }\n }\n return makeNoopPolyfill();\n}\n\n/***/ }),\n\n/***/ \"./packages/logrocket/src/setup.js\":\n/*!*****************************************!*\\\n !*** ./packages/logrocket/src/setup.js ***!\n \\*****************************************/\n/***/ (function(__unused_webpack_module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ \"./node_modules/@babel/runtime/helpers/interopRequireDefault.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = setup;\nvar _objectWithoutProperties2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/objectWithoutProperties */ \"./node_modules/@babel/runtime/helpers/objectWithoutProperties.js\"));\nvar _makeLogRocket = _interopRequireDefault(__webpack_require__(/*! ./makeLogRocket */ \"./packages/logrocket/src/makeLogRocket.js\"));\nvar CDN_SERVER_MAP = {\n 'cdn.logrocket.com': 'https://r.logrocket.io',\n 'cdn.logrocket.io': 'https://r.logrocket.io',\n 'cdn.lr-ingest.io': 'https://r.lr-ingest.io',\n 'cdn.lr-in.com': 'https://r.lr-in.com',\n 'cdn.lr-in-prod.com': 'https://r.lr-in-prod.com',\n 'cdn.lr-ingest.com': 'https://r.lr-ingest.com',\n 'cdn.ingest-lr.com': 'https://r.ingest-lr.com',\n 'cdn.lr-intake.com': 'https://r.lr-intake.com',\n 'cdn.intake-lr.com': 'https://r.intake-lr.com',\n 'cdn.logr-ingest.com': 'https://r.logr-ingest.com',\n 'cdn.lrkt-in.com': 'https://r.lrkt-in.com',\n 'cdn-staging.logrocket.io': 'https://staging-i.logrocket.io',\n 'cdn-staging.lr-ingest.io': 'https://staging-i.lr-ingest.io',\n 'cdn-staging.lr-in.com': 'https://staging-i.lr-in.com',\n 'cdn-staging.lr-in-prod.com': 'https://staging-i.lr-in-prod.com',\n 'cdn-staging.lr-ingest.com': 'https://staging-i.lr-ingest.com',\n 'cdn-staging.ingest-lr.com': 'https://staging-i.ingest-lr.com',\n 'cdn-staging.lr-intake.com': 'https://staging-i.lr-intake.com',\n 'cdn-staging.intake-lr.com': 'https://staging-i.intake-lr.com',\n 'cdn-staging.logr-ingest.com': 'https://staging-i.logr-ingest.com',\n 'cdn-staging.lrkt-in.com': 'https://staging-i.lrkt-in.com'\n};\nfunction envFromHostname(hostname) {\n if (hostname.startsWith('cdn-staging')) {\n return 'staging';\n } else if (hostname.startsWith('localhost')) {\n return 'development';\n } else {\n return 'prod';\n }\n}\nfunction getDomainsAndEnv(sdkVersion) {\n if (sdkVersion === 'script') {\n // We cannot rely on the DEPLOY_ENV config for script tag usage: we deploy the script built for staging to prod to\n // improve deployment times, so the DEPLOY_ENV is always 'staging' for script usage! Instead we default to 'prod'\n // and inspect the script's URL to determine if the environment should instead be staging or development.\n try {\n // eslint-disable-next-line compat/compat\n var scriptTag = document.currentScript;\n var matches = scriptTag.src.match(/^(https?:\\/\\/([^\\\\]+))\\/.+$/);\n var scriptHostname = matches && matches[2];\n if (scriptHostname && CDN_SERVER_MAP[scriptHostname]) {\n return {\n scriptEnv: envFromHostname(scriptHostname),\n scriptOrigin: matches && matches[1],\n scriptIngest: CDN_SERVER_MAP[scriptHostname]\n };\n }\n } catch (_) {\n /* no-op */\n }\n\n // If we cannot determine the env based on the script's URL we default to prod.\n return {\n scriptEnv: 'prod',\n scriptOrigin: 'https://cdn.logrocket.io'\n };\n } else {\n // NPM package\n return {\n scriptEnv: undefined,\n scriptOrigin: false ? 0 : 'https://cdn.lrkt-in.com',\n scriptIngest: false ? 0 : 'https://r.lrkt-in.com'\n };\n }\n}\nfunction setup() {\n var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n enterpriseServer = _ref.enterpriseServer,\n _ref$sdkVersion = _ref.sdkVersion,\n sdkVersion = _ref$sdkVersion === void 0 ? \"9.0.0\" : _ref$sdkVersion,\n opts = (0, _objectWithoutProperties2.default)(_ref, [\"enterpriseServer\", \"sdkVersion\"]);\n var _getDomainsAndEnv = getDomainsAndEnv(sdkVersion),\n scriptEnv = _getDomainsAndEnv.scriptEnv,\n scriptOrigin = _getDomainsAndEnv.scriptOrigin,\n scriptIngest = _getDomainsAndEnv.scriptIngest;\n var sdkServer = opts.sdkServer || enterpriseServer;\n var ingestServer = opts.ingestServer || enterpriseServer || scriptIngest;\n var instance = (0, _makeLogRocket.default)(function () {\n var script = document.createElement('script');\n if (ingestServer) {\n if (typeof window.__SDKCONFIG__ === 'undefined') {\n window.__SDKCONFIG__ = {};\n }\n window.__SDKCONFIG__.serverURL = \"\".concat(ingestServer, \"/i\");\n window.__SDKCONFIG__.statsURL = \"\".concat(ingestServer, \"/s\");\n window.__SDKCONFIG__.scriptEnv = scriptEnv;\n }\n if (sdkServer) {\n script.src = \"\".concat(sdkServer, \"/logger.min.js\");\n } else if (window.__SDKCONFIG__ && window.__SDKCONFIG__.loggerURL) {\n script.src = window.__SDKCONFIG__.loggerURL;\n } else if (window._lrAsyncScript) {\n script.src = window._lrAsyncScript;\n } else {\n script.src = \"\".concat(scriptOrigin, \"/logger-1.min.js\");\n }\n script.async = true;\n document.head.appendChild(script);\n script.onload = function () {\n // Brave browser: Advertises its user-agent as Chrome ##.##... then\n // loads logger.min.js, but blocks the execution of the script\n // causing _LRlogger to be undefined. Let's make sure its there first.\n if (typeof window._LRLogger === 'function') {\n instance.onLogger(new window._LRLogger({\n sdkVersion: sdkVersion\n }));\n } else {\n console.warn('LogRocket: script execution has been blocked by a product or service.');\n instance.uninstall();\n }\n };\n script.onerror = function () {\n console.warn('LogRocket: script could not load. Check that you have a valid network connection.');\n instance.uninstall();\n };\n });\n return instance;\n}\n\n/***/ }),\n\n/***/ \"./node_modules/@babel/runtime/helpers/arrayLikeToArray.js\":\n/*!*****************************************************************!*\\\n !*** ./node_modules/@babel/runtime/helpers/arrayLikeToArray.js ***!\n \\*****************************************************************/\n/***/ (function(module) {\n\nfunction _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];\n return arr2;\n}\nmodule.exports = _arrayLikeToArray, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;\n\n/***/ }),\n\n/***/ \"./node_modules/@babel/runtime/helpers/arrayWithoutHoles.js\":\n/*!******************************************************************!*\\\n !*** ./node_modules/@babel/runtime/helpers/arrayWithoutHoles.js ***!\n \\******************************************************************/\n/***/ (function(module, __unused_webpack_exports, __webpack_require__) {\n\nvar arrayLikeToArray = __webpack_require__(/*! ./arrayLikeToArray.js */ \"./node_modules/@babel/runtime/helpers/arrayLikeToArray.js\");\nfunction _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) return arrayLikeToArray(arr);\n}\nmodule.exports = _arrayWithoutHoles, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;\n\n/***/ }),\n\n/***/ \"./node_modules/@babel/runtime/helpers/classCallCheck.js\":\n/*!***************************************************************!*\\\n !*** ./node_modules/@babel/runtime/helpers/classCallCheck.js ***!\n \\***************************************************************/\n/***/ (function(module) {\n\nfunction _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\nmodule.exports = _classCallCheck, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;\n\n/***/ }),\n\n/***/ \"./node_modules/@babel/runtime/helpers/createClass.js\":\n/*!************************************************************!*\\\n !*** ./node_modules/@babel/runtime/helpers/createClass.js ***!\n \\************************************************************/\n/***/ (function(module, __unused_webpack_exports, __webpack_require__) {\n\nvar toPropertyKey = __webpack_require__(/*! ./toPropertyKey.js */ \"./node_modules/@babel/runtime/helpers/toPropertyKey.js\");\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, toPropertyKey(descriptor.key), descriptor);\n }\n}\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n Object.defineProperty(Constructor, \"prototype\", {\n writable: false\n });\n return Constructor;\n}\nmodule.exports = _createClass, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;\n\n/***/ }),\n\n/***/ \"./node_modules/@babel/runtime/helpers/defineProperty.js\":\n/*!***************************************************************!*\\\n !*** ./node_modules/@babel/runtime/helpers/defineProperty.js ***!\n \\***************************************************************/\n/***/ (function(module, __unused_webpack_exports, __webpack_require__) {\n\nvar toPropertyKey = __webpack_require__(/*! ./toPropertyKey.js */ \"./node_modules/@babel/runtime/helpers/toPropertyKey.js\");\nfunction _defineProperty(obj, key, value) {\n key = toPropertyKey(key);\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n return obj;\n}\nmodule.exports = _defineProperty, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;\n\n/***/ }),\n\n/***/ \"./node_modules/@babel/runtime/helpers/interopRequireDefault.js\":\n/*!**********************************************************************!*\\\n !*** ./node_modules/@babel/runtime/helpers/interopRequireDefault.js ***!\n \\**********************************************************************/\n/***/ (function(module) {\n\nfunction _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n \"default\": obj\n };\n}\nmodule.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;\n\n/***/ }),\n\n/***/ \"./node_modules/@babel/runtime/helpers/iterableToArray.js\":\n/*!****************************************************************!*\\\n !*** ./node_modules/@babel/runtime/helpers/iterableToArray.js ***!\n \\****************************************************************/\n/***/ (function(module) {\n\nfunction _iterableToArray(iter) {\n if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter);\n}\nmodule.exports = _iterableToArray, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;\n\n/***/ }),\n\n/***/ \"./node_modules/@babel/runtime/helpers/nonIterableSpread.js\":\n/*!******************************************************************!*\\\n !*** ./node_modules/@babel/runtime/helpers/nonIterableSpread.js ***!\n \\******************************************************************/\n/***/ (function(module) {\n\nfunction _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\nmodule.exports = _nonIterableSpread, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;\n\n/***/ }),\n\n/***/ \"./node_modules/@babel/runtime/helpers/objectWithoutProperties.js\":\n/*!************************************************************************!*\\\n !*** ./node_modules/@babel/runtime/helpers/objectWithoutProperties.js ***!\n \\************************************************************************/\n/***/ (function(module, __unused_webpack_exports, __webpack_require__) {\n\nvar objectWithoutPropertiesLoose = __webpack_require__(/*! ./objectWithoutPropertiesLoose.js */ \"./node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js\");\nfunction _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n var target = objectWithoutPropertiesLoose(source, excluded);\n var key, i;\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n return target;\n}\nmodule.exports = _objectWithoutProperties, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;\n\n/***/ }),\n\n/***/ \"./node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js\":\n/*!*****************************************************************************!*\\\n !*** ./node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js ***!\n \\*****************************************************************************/\n/***/ (function(module) {\n\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n return target;\n}\nmodule.exports = _objectWithoutPropertiesLoose, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;\n\n/***/ }),\n\n/***/ \"./node_modules/@babel/runtime/helpers/toConsumableArray.js\":\n/*!******************************************************************!*\\\n !*** ./node_modules/@babel/runtime/helpers/toConsumableArray.js ***!\n \\******************************************************************/\n/***/ (function(module, __unused_webpack_exports, __webpack_require__) {\n\nvar arrayWithoutHoles = __webpack_require__(/*! ./arrayWithoutHoles.js */ \"./node_modules/@babel/runtime/helpers/arrayWithoutHoles.js\");\nvar iterableToArray = __webpack_require__(/*! ./iterableToArray.js */ \"./node_modules/@babel/runtime/helpers/iterableToArray.js\");\nvar unsupportedIterableToArray = __webpack_require__(/*! ./unsupportedIterableToArray.js */ \"./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js\");\nvar nonIterableSpread = __webpack_require__(/*! ./nonIterableSpread.js */ \"./node_modules/@babel/runtime/helpers/nonIterableSpread.js\");\nfunction _toConsumableArray(arr) {\n return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();\n}\nmodule.exports = _toConsumableArray, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;\n\n/***/ }),\n\n/***/ \"./node_modules/@babel/runtime/helpers/toPrimitive.js\":\n/*!************************************************************!*\\\n !*** ./node_modules/@babel/runtime/helpers/toPrimitive.js ***!\n \\************************************************************/\n/***/ (function(module, __unused_webpack_exports, __webpack_require__) {\n\nvar _typeof = (__webpack_require__(/*! ./typeof.js */ \"./node_modules/@babel/runtime/helpers/typeof.js\")[\"default\"]);\nfunction _toPrimitive(input, hint) {\n if (_typeof(input) !== \"object\" || input === null) return input;\n var prim = input[Symbol.toPrimitive];\n if (prim !== undefined) {\n var res = prim.call(input, hint || \"default\");\n if (_typeof(res) !== \"object\") return res;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (hint === \"string\" ? String : Number)(input);\n}\nmodule.exports = _toPrimitive, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;\n\n/***/ }),\n\n/***/ \"./node_modules/@babel/runtime/helpers/toPropertyKey.js\":\n/*!**************************************************************!*\\\n !*** ./node_modules/@babel/runtime/helpers/toPropertyKey.js ***!\n \\**************************************************************/\n/***/ (function(module, __unused_webpack_exports, __webpack_require__) {\n\nvar _typeof = (__webpack_require__(/*! ./typeof.js */ \"./node_modules/@babel/runtime/helpers/typeof.js\")[\"default\"]);\nvar toPrimitive = __webpack_require__(/*! ./toPrimitive.js */ \"./node_modules/@babel/runtime/helpers/toPrimitive.js\");\nfunction _toPropertyKey(arg) {\n var key = toPrimitive(arg, \"string\");\n return _typeof(key) === \"symbol\" ? key : String(key);\n}\nmodule.exports = _toPropertyKey, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;\n\n/***/ }),\n\n/***/ \"./node_modules/@babel/runtime/helpers/typeof.js\":\n/*!*******************************************************!*\\\n !*** ./node_modules/@babel/runtime/helpers/typeof.js ***!\n \\*******************************************************/\n/***/ (function(module) {\n\nfunction _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n return (module.exports = _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) {\n return typeof obj;\n } : function (obj) {\n return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n }, module.exports.__esModule = true, module.exports[\"default\"] = module.exports), _typeof(obj);\n}\nmodule.exports = _typeof, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;\n\n/***/ }),\n\n/***/ \"./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js\":\n/*!***************************************************************************!*\\\n !*** ./node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js ***!\n \\***************************************************************************/\n/***/ (function(module, __unused_webpack_exports, __webpack_require__) {\n\nvar arrayLikeToArray = __webpack_require__(/*! ./arrayLikeToArray.js */ \"./node_modules/@babel/runtime/helpers/arrayLikeToArray.js\");\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen);\n}\nmodule.exports = _unsupportedIterableToArray, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;\n\n/***/ })\n\n/******/ \t});\n/************************************************************************/\n/******/ \t// The module cache\n/******/ \tvar __webpack_module_cache__ = {};\n/******/ \t\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/ \t\t// Check if module is in cache\n/******/ \t\tvar cachedModule = __webpack_module_cache__[moduleId];\n/******/ \t\tif (cachedModule !== undefined) {\n/******/ \t\t\treturn cachedModule.exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = __webpack_module_cache__[moduleId] = {\n/******/ \t\t\t// no module.id needed\n/******/ \t\t\t// no module.loaded needed\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/ \t\n/******/ \t\t// Execute the module function\n/******/ \t\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n/******/ \t\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/ \t\n/************************************************************************/\n/******/ \t/* webpack/runtime/global */\n/******/ \t!function() {\n/******/ \t\t__webpack_require__.g = (function() {\n/******/ \t\t\tif (typeof globalThis === 'object') return globalThis;\n/******/ \t\t\ttry {\n/******/ \t\t\t\treturn this || new Function('return this')();\n/******/ \t\t\t} catch (e) {\n/******/ \t\t\t\tif (typeof window === 'object') return window;\n/******/ \t\t\t}\n/******/ \t\t})();\n/******/ \t}();\n/******/ \t\n/************************************************************************/\nvar __webpack_exports__ = {};\n// This entry need to be wrapped in an IIFE because it need to be in strict mode.\n!function() {\n\"use strict\";\nvar exports = __webpack_exports__;\n/*!**********************************************!*\\\n !*** ./packages/logrocket/src/module-npm.js ***!\n \\**********************************************/\n\n\nvar _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ \"./node_modules/@babel/runtime/helpers/interopRequireDefault.js\");\nObject.defineProperty(exports, \"__esModule\", ({\n value: true\n}));\nexports[\"default\"] = void 0;\nvar _setup = _interopRequireDefault(__webpack_require__(/*! ./setup */ \"./packages/logrocket/src/setup.js\"));\nvar instance = (0, _setup.default)();\nvar _default = instance;\nexports[\"default\"] = _default;\n}();\n__webpack_exports__ = __webpack_exports__[\"default\"];\n/******/ \treturn __webpack_exports__;\n/******/ })()\n;\n});","import api from \"@core/services/api\";\r\nimport ENUMS from \"@core/classes/Enums\";\r\nimport moment from 'moment'\r\nimport util from '@core/services/util'\r\nimport MapsService from '@core/services/maps'\r\nimport $modal from '@core/services/modal'\r\nimport modalConfirmCustomerApplicationInfo from '@core/modals/customerApp/modalConfirmCustomerApplicationInfo.vue'\r\nimport modalCustomerApplicationInfo from '@core/modals/customerApp/modalCustomerApplicationInfo.vue'\r\nimport modalInfo from '@core/modals/modalInfo.vue'\r\nimport LogRocket from 'logrocket';\r\nimport Application from \"./Application\";\r\nimport ApplicationsPreFilledData from \"./ApplicationsPreFilledData\";\r\nimport ApplicationsQuoteAppData from \"./ApplicationsQuoteAppData\";\r\nimport ApplicationsDataAnswered from \"./ApplicationsDataAnswered\";\r\nimport ApplicationsPersonalInfo from \"./ApplicationsPersonalInfo\";\r\nimport ApplicationsRebates from \"./ApplicationsRebates\";\r\nimport DocumentAssociation from '@core/classes/DocumentAssociation';\r\nimport {redirectToCustomerPortal} from \"@core/helpers/Customer/customer-helper\";\r\nimport settings from 'settings'\r\n\r\n\r\nexport function resetDateCompleted(value, extraSaves, question, application) {\r\n if (application.dateCompleted != null && application.status == ENUMS.CUSTOMER_APPLICATION_STATUS.CompletedNoCredit) {\r\n application.dateCompleted = null\r\n }\r\n}\r\n\r\nexport async function findPlaidCustomerRecord(value, extraSaves, question, application) {\r\n if (!application.plaidId) {\r\n let documentAssociations = [\r\n new DocumentAssociation({\r\n type: ENUMS.DOC_ASSOCIATION.Customer,\r\n id: application.customerId\r\n })\r\n ]\r\n let response = await api.plaid.getPastPlaidExchanges(documentAssociations, ENUMS.PLAID_INTERACTION.GetIdentityVerification)\r\n\r\n if (response && response.data && response.data.length > 0) {\r\n const plaidData = response.data.sort((a, b) => (a.timestamp < b.timestamp) ? 1 : -1).find(r => r.identityVerification != null).identityVerification.response;\r\n await plaidInfo(plaidData, extraSaves, question, application)\r\n }\r\n }\r\n}\r\n\r\nexport async function plaidInfo(plaidData, extraSaves, question, application) {\r\n if (plaidData && plaidData.clientUserId) {\r\n application.plaidId = plaidData.clientUserId\r\n console.log(\"PlaidData\", plaidData);\r\n\r\n let driverLicense = plaidData.documentaryVerification?.documents?.find(d => d.extractedData?.category == 0)?.extractedData\r\n if (driverLicense) {\r\n let driverLicenseObj = {\r\n type: 1,\r\n idNumber: driverLicense.idNumber,\r\n jurisdiction: driverLicense.issuingRegion,\r\n expirationDate: moment(driverLicense.expirationDate, \"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\")\r\n }\r\n\r\n application.quoteAppData.applicationsDataAnswered.personalInfo.identifications.push(driverLicenseObj)\r\n }\r\n }\r\n}\r\n\r\n//TODO: In the future, we will refactor the action 1 on provideGenerationSuffixQuestion, so when the user clicks 'Back' on the question, it doesn't clear the typed answer.\r\nexport async function clearSuffixIfOther(suffix, extraSaves, question, application) {\r\n let provideGenerationSuffixQuestion = application.quoteAppData.questions.find(q => q.key == \"provideGenerationSuffix\")\r\n\r\n if (provideGenerationSuffixQuestion?.savedAnswer == 'other') {\r\n application.quoteAppData.applicationsDataAnswered.personalInfo.generationSuffix = null\r\n provideGenerationSuffixQuestion?.clearAnswer()\r\n }\r\n}\r\n\r\nexport async function clearAddress(country, extraSaves, question, application) {\r\n let data = []\r\n let applicationsDataAnswered = application.quoteAppData.applicationsDataAnswered\r\n let personalInfo = applicationsDataAnswered.personalInfo\r\n let businessInfo = applicationsDataAnswered.businessInfo\r\n\r\n switch (question.key) {\r\n case \"liveInsideUS\":\r\n if ((country && personalInfo.currentResidence.country != \"US\") || (!country && personalInfo.currentResidence.country == \"US\")) {\r\n data = [\r\n { questionKey: \"provideZipCode\", dataKey: null },\r\n { questionKey: \"provideApartment\", dataKey: null },\r\n { questionKey: \"provideStreetAddress\", dataKey: null },\r\n { questionKey: \"provideOutsideUSStreetAddress\", dataKey: null },\r\n { questionKey: \"provideCity\", dataKey: null },\r\n { questionKey: \"provideState\", dataKey: null },\r\n { questionKey: \"provideOutsideUSState\", dataKey: null },\r\n { questionKey: \"provideCounty\", dataKey: null },\r\n ]\r\n }\r\n break\r\n case \"liveInsideUSPreviously\":\r\n if ((country && personalInfo.previousResidence.country != \"US\") || (!country && personalInfo.previousResidence.country == \"US\")) {\r\n data = [\r\n { questionKey: \"providePreviousZipCode\", dataKey: null },\r\n { questionKey: \"providePreviousApartment\", dataKey: null },\r\n { questionKey: \"providePreviousStreetAddress\", dataKey: null },\r\n { questionKey: \"providePreviousOutsideUSStreetAddress\", dataKey: null },\r\n { questionKey: \"providePreviousCity\", dataKey: null },\r\n { questionKey: \"providePreviousState\", dataKey: null },\r\n { questionKey: \"providePreviousOutsideUSState\", dataKey: null },\r\n { questionKey: \"providePreviousCounty\", dataKey: null },\r\n ]\r\n }\r\n break\r\n case \"garagedAddressOutsideUS\":\r\n if ((country && applicationsDataAnswered.garagedAddressOutsideUS != \"US\") || !country) {\r\n // garage address is only collected if inside US\r\n data = [\r\n { questionKey: \"provideGaragedZipCode\", dataKey: null },\r\n { questionKey: \"provideGaragedApartment\", dataKey: null },\r\n { questionKey: \"provideGaragedStreetAddress\", dataKey: null },\r\n { questionKey: \"provideGaragedCity\", dataKey: null },\r\n { questionKey: \"provideGaragedState\", dataKey: null },\r\n { questionKey: \"provideGaragedCounty\", dataKey: null },\r\n ]\r\n }\r\n break\r\n case \"businessInsideUS\":\r\n if ((country && businessInfo.address.country != \"US\") || (!country && businessInfo.address.country == \"US\")) {\r\n data = [\r\n { questionKey: \"provideBusinessZipCode\", dataKey: null },\r\n { questionKey: \"provideBusinessApartment\", dataKey: null },\r\n { questionKey: \"provideBusinessStreetAddress\", dataKey: null },\r\n { questionKey: \"provideBusinessOutsideUSStreetAddress\", dataKey: null },\r\n { questionKey: \"provideBusinessCity\", dataKey: null },\r\n { questionKey: \"provideBusinessState\", dataKey: null },\r\n { questionKey: \"provideBusinessOutsideUSState\", dataKey: null },\r\n { questionKey: \"provideBusinessCounty\", dataKey: null },\r\n ]\r\n }\r\n break\r\n case \"operatorLiveInsideUS\":\r\n if ((country && businessInfo.businessOperator.address.country != \"US\") || (!country && businessInfo.businessOperator.address.country == \"US\")) {\r\n data = [\r\n { questionKey: \"provideOperatorZipCode\", dataKey: null },\r\n { questionKey: \"provideOperatorApartment\", dataKey: null },\r\n { questionKey: \"provideOperatorStreetAddress\", dataKey: null },\r\n { questionKey: \"provideOperatorOutsideUSStreetAddress\", dataKey: null },\r\n { questionKey: \"provideOperatorCity\", dataKey: null },\r\n { questionKey: \"provideOperatorState\", dataKey: null },\r\n { questionKey: \"provideOperatorOutsideUSState\", dataKey: null },\r\n { questionKey: \"provideOperatorCounty\", dataKey: null },\r\n ]\r\n }\r\n break\r\n case \"principalLiveInsideUS\":\r\n if ((country && businessInfo.businessPrincipal.address.country != \"US\") || (!country && businessInfo.businessPrincipal.address.country == \"US\")) {\r\n data = [\r\n { questionKey: \"providePrincipalZipCode\", dataKey: null },\r\n { questionKey: \"providePrincipalApartment\", dataKey: null },\r\n { questionKey: \"providePrincipalStreetAddress\", dataKey: null },\r\n { questionKey: \"providePrincipalOutsideUSStreetAddress\", dataKey: null },\r\n { questionKey: \"providePrincipalCity\", dataKey: null },\r\n { questionKey: \"providePrincipalState\", dataKey: null },\r\n { questionKey: \"providePrincipalOutsideUSState\", dataKey: null },\r\n { questionKey: \"providePrincipalCounty\", dataKey: null },\r\n ]\r\n }\r\n break\r\n }\r\n\r\n if (data.length > 0) {\r\n updateData(data, application)\r\n }\r\n}\r\n\r\nexport async function updateSelectedAddress(address, extraSaves, question, application, searchText) {\r\n if (extraSaves[0]?.description == '-- NOT LISTED --') {\r\n if (question.key == \"provideStreetAddress\") {\r\n application.quoteAppData.questions.find(q => q.key == \"provideCity\").savedAnswer = null\r\n application.quoteAppData.questions.find(q => q.key == \"provideState\").savedAnswer = null\r\n application.quoteAppData.questions.find(q => q.key == \"provideCounty\").savedAnswer = null\r\n }\r\n else if (question.key == \"providePreviousStreetAddress\") {\r\n application.quoteAppData.questions.find(q => q.key == \"providePreviousCity\").savedAnswer = null\r\n application.quoteAppData.questions.find(q => q.key == \"providePreviousState\").savedAnswer = null\r\n application.quoteAppData.questions.find(q => q.key == \"providePreviousCounty\").savedAnswer = null\r\n }\r\n else {\r\n application.quoteAppData.questions.find(q => q.key == \"provideGaragedCity\").savedAnswer = null\r\n application.quoteAppData.questions.find(q => q.key == \"provideGaragedState\").savedAnswer = null\r\n application.quoteAppData.questions.find(q => q.key == \"provideGaragedCounty\").savedAnswer = null\r\n }\r\n\r\n return searchText\r\n }\r\n else if (extraSaves[0].structured_formatting) {\r\n let address1 = extraSaves[0].structured_formatting.main_text\r\n await saveSelectedAddressValues(address1, extraSaves, question, application)\r\n return address1\r\n }\r\n}\r\n\r\nasync function saveSelectedAddressValues(address, extraSaves, question, application) {\r\n if (extraSaves[0]?.place_id) {\r\n let mapService = new MapsService();\r\n await mapService.getAddressDetails(extraSaves[0], (addressDetails) => {\r\n\r\n let data = []\r\n\r\n switch (question.key) {\r\n case \"provideStreetAddress\":\r\n data = [\r\n { questionKey: \"provideZipCode\", dataKey: addressDetails.zip },\r\n { questionKey: \"provideStreetAddress\", dataKey: address },\r\n { questionKey: \"provideCity\", dataKey: addressDetails.city },\r\n { questionKey: \"provideState\", dataKey: addressDetails.state },\r\n { questionKey: \"provideCounty\", dataKey: addressDetails.county },\r\n ]\r\n break\r\n case \"providePreviousStreetAddress\":\r\n data = [\r\n { questionKey: \"providePreviousZipCode\", dataKey: addressDetails.zip },\r\n { questionKey: \"providePreviousStreetAddress\", dataKey: address },\r\n { questionKey: \"providePreviousCity\", dataKey: addressDetails.city },\r\n { questionKey: \"providePreviousState\", dataKey: addressDetails.state },\r\n { questionKey: \"providePreviousCounty\", dataKey: addressDetails.county },\r\n ]\r\n break\r\n case \"provideGaragedStreetAddress\":\r\n data = [\r\n { questionKey: \"provideGaragedZipCode\", dataKey: addressDetails.zip },\r\n { questionKey: \"provideGaragedStreetAddress\", dataKey: address },\r\n { questionKey: \"provideGaragedCity\", dataKey: addressDetails.city },\r\n { questionKey: \"provideGaragedState\", dataKey: addressDetails.state },\r\n { questionKey: \"provideGaragedCounty\", dataKey: addressDetails.county },\r\n ]\r\n break\r\n case \"provideBusinessStreetAddress\":\r\n data = [\r\n { questionKey: \"provideBusinessZipCode\", dataKey: addressDetails.zip },\r\n { questionKey: \"provideBusinessStreetAddress\", dataKey: address },\r\n { questionKey: \"provideBusinessCity\", dataKey: addressDetails.city },\r\n { questionKey: \"provideBusinessState\", dataKey: addressDetails.state },\r\n { questionKey: \"provideBusinessCounty\", dataKey: addressDetails.county },\r\n ]\r\n break\r\n case \"provideOperatorStreetAddress\":\r\n data = [\r\n { questionKey: \"provideOperatorZipCode\", dataKey: addressDetails.zip },\r\n { questionKey: \"provideOperatorStreetAddress\", dataKey: address },\r\n { questionKey: \"provideOperatorCity\", dataKey: addressDetails.city },\r\n { questionKey: \"provideOperatorState\", dataKey: addressDetails.state },\r\n { questionKey: \"provideOperatorCounty\", dataKey: addressDetails.county },\r\n ]\r\n break\r\n case \"providePrincipalStreetAddress\":\r\n data = [\r\n { questionKey: \"providePrincipalZipCode\", dataKey: addressDetails.zip },\r\n { questionKey: \"providePrincipalStreetAddress\", dataKey: address },\r\n { questionKey: \"providePrincipalCity\", dataKey: addressDetails.city },\r\n { questionKey: \"providePrincipalState\", dataKey: addressDetails.state },\r\n { questionKey: \"providePrincipalCounty\", dataKey: addressDetails.county },\r\n ]\r\n break\r\n }\r\n\r\n let zipCode = null\r\n let zipCodeKey = data.find(d => d.dataKey == addressDetails.zip).questionKey\r\n let zipCodeQuestion = application.quoteAppData.questions.find(q => q.key == zipCodeKey)\r\n zipCode = zipCodeQuestion.getValue(zipCodeQuestion.dataStructurePath)\r\n\r\n if (addressDetails.zip && zipCode.slice(0, 5) != addressDetails.zip) {\r\n let title = null\r\n let message = null\r\n if (application.quoteAppData.language == \"English\") {\r\n title = \"Zip Code Discrepancy\"\r\n message = \"The zip code entered is different than the zip code we found. Please select which zip code is the correct one that should be used.\"\r\n }\r\n else {\r\n title = \"Discrepancia en cรณdigo postal\"\r\n message = \"El cรณdigo postal ingresado es diferente al cรณdigo postal que encontramos. Por favor seleccione el cรณdigo postal correcto que debemos usar.\"\r\n }\r\n //call modal\r\n $modal.open(modalConfirmCustomerApplicationInfo, {\r\n name: 'modalConfirmCustomerApplicationInfo',\r\n passedData: {\r\n title: title,\r\n info: message,\r\n alternativeValueText: addressDetails.zip,\r\n currentValueText: zipCode,\r\n },\r\n backdrop: false,\r\n postFunction: () => {\r\n updateData(data.filter(d => d.dataKey == addressDetails.zip), application)\r\n }\r\n });\r\n }\r\n\r\n updateData(data.filter(d => d.dataKey != addressDetails.zip), application)\r\n });\r\n }\r\n}\r\n\r\nfunction updateData(data, application) {\r\n data.forEach(d => {\r\n let questionToUpdate = application.quoteAppData.questions.find(q => q.key == d.questionKey)\r\n if (questionToUpdate) {\r\n questionToUpdate.savedAnswer = d.dataKey\r\n questionToUpdate.setValue(d.dataKey)\r\n }\r\n })\r\n}\r\n\r\nexport async function expirationDateInThePast(expirationDate, extraSaves, question, application) {\r\n if (moment(expirationDate, \"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\").diff(moment(), 'days') <= 0) {\r\n $modal.open(modalCustomerApplicationInfo, { name: 'modalCustomerApplicationInfo', passedData: { title: 'Expiration Date in the Past', info: 'Please note you entered a date in the past', acceptText: 'OK' }, backdrop: false });\r\n }\r\n}\r\n\r\n\r\nexport async function redirectToCustomerPortalInApp(data, extraSaves, question, application) {\r\n settings.disableBrowserRedirectPopup = true;\r\n let linkForRedirect = await redirectToCustomerPortal(application.customerId)\r\n window.location.href = linkForRedirect;\r\n\r\n}\r\n\r\n\r\n\r\n\r\nexport async function plateToVIN(state, extraSaves, question, application) {\r\n const storeCode = application.storeCode\r\n const plateState = state\r\n const plateNumberIndex = question.key.split(\"-\")[1]\r\n let plateNumber = null\r\n if (question.key.toLowerCase().includes('current')) {\r\n plateNumber = application.quoteAppData.applicationsDataAnswered.rebates.rebateCurrentVehicles.vehicles[plateNumberIndex].vehiclePlate\r\n }\r\n else {\r\n plateNumber = application.quoteAppData.applicationsDataAnswered.rebates.rebateReturnedLeaseVehicles.vehicles[plateNumberIndex].vehiclePlate\r\n }\r\n\r\n let response = await api.cbc.plateToVIN(storeCode, plateState, plateNumber)\r\n let index = question.key.split('-')[1]\r\n\r\n if (response.data?.vin) {\r\n await vinLookup(response.data.vin, extraSaves, question, application)\r\n }\r\n else {\r\n if (question.key.toLowerCase().includes('current')) {\r\n application.quoteAppData.questions.find(q => q.key == \"rebateCurrentVehiclesYear-\" + index).savedAnswer = null\r\n application.quoteAppData.questions.find(q => q.key == \"rebateCurrentVehiclesMake-\" + index).savedAnswer = null\r\n application.quoteAppData.questions.find(q => q.key == \"rebateCurrentVehiclesModel-\" + index).savedAnswer = null\r\n }\r\n else {\r\n application.quoteAppData.questions.find(q => q.key == \"rebateReturnedLeaseVehiclesYear-\" + index).savedAnswer = null\r\n application.quoteAppData.questions.find(q => q.key == \"rebateReturnedLeaseVehiclesMake-\" + index).savedAnswer = null\r\n application.quoteAppData.questions.find(q => q.key == \"rebateReturnedLeaseVehiclesModel-\" + index).savedAnswer = null\r\n }\r\n }\r\n}\r\n\r\nexport async function vinLookup(vin, extraSaves, question, application) {\r\n let response = await api.vinLookup(vin)\r\n let index = question.key.split('-')[1]\r\n console.log(\"response\", response);\r\n if (response && response.data) {\r\n if (question.key.toLowerCase().includes('current')) {\r\n application.quoteAppData.questions.find(q => q.key == \"rebateCurrentVehiclesYear-\" + index).savedAnswer = `${response.data.payload.modelYear}`\r\n application.quoteAppData.questions.find(q => q.key == \"rebateCurrentVehiclesMake-\" + index).savedAnswer = `${response.data.payload.division}`\r\n application.quoteAppData.questions.find(q => q.key == \"rebateCurrentVehiclesModel-\" + index).savedAnswer = response.data.payload.modelName\r\n }\r\n else {\r\n application.quoteAppData.questions.find(q => q.key == \"rebateReturnedLeaseVehiclesYear-\" + index).savedAnswer = `${response.data.payload.modelYear}`\r\n application.quoteAppData.questions.find(q => q.key == \"rebateReturnedLeaseVehiclesMake-\" + index).savedAnswer = response.data.payload.division\r\n application.quoteAppData.questions.find(q => q.key == \"rebateReturnedLeaseVehiclesModel-\" + index).savedAnswer = response.data.payload.modelName\r\n }\r\n }\r\n else {\r\n if (question.key.toLowerCase().includes('current')) {\r\n application.quoteAppData.questions.find(q => q.key == \"rebateCurrentVehiclesYear-\" + index).savedAnswer = null\r\n application.quoteAppData.questions.find(q => q.key == \"rebateCurrentVehiclesMake-\" + index).savedAnswer = null\r\n application.quoteAppData.questions.find(q => q.key == \"rebateCurrentVehiclesModel-\" + index).savedAnswer = null\r\n }\r\n else {\r\n application.quoteAppData.questions.find(q => q.key == \"rebateReturnedLeaseVehiclesYear-\" + index).savedAnswer = null\r\n application.quoteAppData.questions.find(q => q.key == \"rebateReturnedLeaseVehiclesMake-\" + index).savedAnswer = null\r\n application.quoteAppData.questions.find(q => q.key == \"rebateReturnedLeaseVehiclesModel-\" + index).savedAnswer = null\r\n }\r\n\r\n }\r\n}\r\n\r\n//export async function createNewApplication(value, extraSaves, question, application) {\r\n// // Only execute if the transaction is under a company and the applicant is the guarantor\r\n// if (application.isBusinessWithApplicantAsGuarantor()) {\r\n// // Create and save new lead\r\n// let lead = {\r\n// id: util.getGuid(),\r\n// firstName: application.preFilledData.firstName,\r\n// lastName: application.preFilledData.lastName,\r\n// fullName: application.preFilledData.firstName + ' ' + application.preFilledData.lastName,\r\n// phoneNumber: application.preFilledData.phoneNumber,\r\n// emailAddress: application.preFilledData.emailAddress,\r\n// dateOfBirth: application.preFilledData.dateOfBirth,\r\n// dateCreated: moment.utc().format()\r\n// }\r\n// console.log(\"LEAD OBJ\", lead);\r\n// await api.customers.saveLead(lead)\r\n\r\n// // Create, populate, and save new Customer Application\r\n// let newApplicationObject = new Application()\r\n// newApplicationObject.isLatestApplication = true\r\n// newApplicationObject.dateCreated = moment.utc().format(\"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\")\r\n// newApplicationObject.editLinkExpiration = moment(\"0001-01-01\", \"YYYY-MM-DD\").format(\"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\")\r\n// newApplicationObject.emailCodeExpiration = moment.utc().format(\"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\")\r\n// newApplicationObject.phoneCodeExpiration = moment.utc().format(\"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\")\r\n// newApplicationObject.id = util.getGuid()\r\n// newApplicationObject.customerId = util.getDefaultGuid()\r\n// newApplicationObject.leadId = lead.id\r\n// newApplicationObject.plaidId = application.plaidId\r\n// newApplicationObject.preFilledData = new ApplicationsPreFilledData(application.preFilledData)\r\n// newApplicationObject.quoteAppData.applicationsDataAnswered = new ApplicationsDataAnswered()\r\n// newApplicationObject.quoteAppData.applicationsDataAnswered.dealTypes = application.quoteAppData.applicationsDataAnswered.dealTypes\r\n// newApplicationObject.quoteAppData.applicationsDataAnswered.garagedAddress = application.quoteAppData.applicationsDataAnswered.garagedAddress\r\n// newApplicationObject.quoteAppData.applicationsDataAnswered.garagedAddressOutsideUS = application.quoteAppData.applicationsDataAnswered.garagedAddressOutsideUS\r\n// newApplicationObject.quoteAppData.applicationsDataAnswered.garagedAddressSameAsResidence = application.quoteAppData.applicationsDataAnswered.garagedAddressSameAsResidence\r\n// newApplicationObject.quoteAppData.applicationsDataAnswered.isBusiness = false\r\n// newApplicationObject.quoteAppData.applicationsDataAnswered.personalInfo = new ApplicationsPersonalInfo(application.quoteAppData.applicationsDataAnswered.personalInfo)\r\n// newApplicationObject.quoteAppData.applicationsDataAnswered.rebates = new ApplicationsRebates(application.quoteAppData.applicationsDataAnswered.rebates)\r\n// newApplicationObject.quoteAppData.currentQuestion = 'provideEstimateCreditScore'\r\n// newApplicationObject.quoteAppData.language = application.language\r\n\r\n// let newPathFollowedLastIndex = application.quoteAppData.pathFollowed.findIndex(key => key == 'isUnderBusiness')\r\n// newApplicationObject.quoteAppData.pathFollowed = application.quoteAppData.pathFollowed.slice(0, newPathFollowedLastIndex)\r\n\r\n// newApplicationObject.storeCode = application.storeCode\r\n// let applicationRequest = {\r\n// application: newApplicationObject,\r\n// isFinished: true,\r\n// isNewSession: true\r\n// }\r\n// await api.applications.saveNewApplication(applicationRequest)\r\n\r\n// // Add guarantor id to current business application and save it\r\n// application.guarantorApplicationId = newApplicationObject.id\r\n// api.applications.setGuarantorIdToCustomerApplication(application.id, application.guarantorApplicationId)\r\n\r\n// //await api.applications.saveApplication(currentApplicationRequest)\r\n\r\n// // Update local storage with the new application\r\n// const userData = util.encryptJSONText(JSON.stringify(newApplicationObject))\r\n// localStorage.setItem('applicationObject', userData)\r\n// }\r\n//}\r\n\r\nexport async function reload(value, extraSaves, question, application) {\r\n window.location.reload();\r\n}\r\n\r\nexport async function encryptTaxId(taxId, extraSaves, question, application) {\r\n //if current taxId is not hashed\r\n if (!taxId.startsWith(\"*****\")) {\r\n\r\n try {\r\n let response = await api.utilities.encrypt(taxId)\r\n if (response.data) {\r\n application.quoteAppData.applicationsDataAnswered.businessInfo.taxIdHashed = response.data.encryptedValue\r\n application.quoteAppData.applicationsDataAnswered.businessInfo.taxIdLast4 = `*****${taxId.substring(taxId.length - 4)}`\r\n question.savedAnswer = application.quoteAppData.applicationsDataAnswered.businessInfo.taxIdLast4\r\n }\r\n } catch (error) {\r\n LogRocket.log(\"Error encrypting SSN\", error);\r\n }\r\n }\r\n}\r\n\r\nexport async function checkCredit(ssn, extraSaves, question, application) {\r\n //if current ssn is not hashed\r\n if (ssn == null && !application.quoteAppData.applicationsDataAnswered.isBusiness) {\r\n await checkFrozen(application)\r\n }\r\n else if (!ssn.startsWith(\"*****\")) {\r\n\r\n application.setSNNType(ssn)\r\n\r\n await api.utilities.encrypt(ssn).then(response => {\r\n if (response.data) {\r\n application.quoteAppData.applicationsDataAnswered.personalInfo.ssnHashed = response.data.encryptedValue\r\n application.quoteAppData.applicationsDataAnswered.personalInfo.ssnLast4 = `*****${ssn.substring(ssn.length - 4)}`\r\n question.savedAnswer = application.quoteAppData.applicationsDataAnswered.personalInfo.ssnLast4\r\n application.quoteAppData.applicationsDataAnswered.personalInfo.lastSuccessfulCreditCheck = null\r\n }\r\n });\r\n\r\n if (application.quoteAppData.applicationsDataAnswered.personalInfo.ssnType == ENUMS.SSN_TYPES.SSN) {\r\n await checkFrozen(application)\r\n }\r\n }\r\n}\r\n\r\nexport async function checkCreditEquifax(value, extraSaves, question, application) {\r\n await checkFrozen(application, application.quoteAppData.applicationsDataAnswered.personalInfo.equifaxPIN)\r\n}\r\n\r\nexport async function checkCreditExperian(value, extraSaves, question, application) {\r\n await checkFrozen(application, null, application.quoteAppData.applicationsDataAnswered.personalInfo.experianPIN)\r\n}\r\n\r\nexport async function checkCreditTransUnion(value, extraSaves, question, application) {\r\n await checkFrozen(application, null, null, application.quoteAppData.applicationsDataAnswered.personalInfo.transUnionPIN)\r\n}\r\n\r\nexport async function encryptSsn(ssn, extraSaves, question, application) {\r\n //if current ssn is not hashed\r\n if (!ssn.startsWith(\"*****\")) {\r\n\r\n application.setSNNType(ssn)\r\n try {\r\n if (ssn == null) {\r\n util.toastr(\"error\", \"Error\", \"Error adding SSN. Please refresh and try again.\")\r\n LogRocket.log(\"No ssn value\", ssn);\r\n throw new Error(\"no ssn value\")\r\n }\r\n const response = await api.utilities.encrypt(ssn);\r\n\r\n if (response?.data?.encryptedValue) {\r\n application.quoteAppData.applicationsDataAnswered.personalInfo.ssnHashed = response.data.encryptedValue\r\n application.quoteAppData.applicationsDataAnswered.personalInfo.ssnLast4 = `*****${ssn.substring(ssn.length - 4)}`\r\n question.savedAnswer = application.quoteAppData.applicationsDataAnswered.personalInfo.ssnLast4\r\n } else {\r\n util.toastr(\"error\", \"Error\", \"Error encrypting SSN. Please refresh and try again.\")\r\n LogRocket.log(\"Failed to encrypt SSN in the backend\");\r\n throw new Error(\"Failed to encrypt SSN in the backend\");\r\n }\r\n\r\n } catch (error) {\r\n util.toastr(\"error\", \"Error\", \"Error encrypting SSN. Please refresh and try again.\")\r\n LogRocket.log(\"Error encrypting SSN\", error);\r\n throw new Error(\"error encrypting\")\r\n }\r\n }\r\n}\r\n\r\nasync function checkFrozen(application, EquifaxPin = null, ExperianPin = null, TransUnionPin = null) {\r\n if (shouldWeCheckCredit(application)) {\r\n let experianFrozen = true;\r\n let transUnionFrozen = true;\r\n let equifaxFrozen = true;\r\n\r\n let req = {\r\n StoreCode: application.storeCode,\r\n AppID: application.id,\r\n ApplicantID: application.customerId,\r\n EquifaxPin: EquifaxPin,\r\n ExperianPin: ExperianPin,\r\n TransUnionPin: TransUnionPin,\r\n ReportType: reportTypeStringToEnum('XPN|TU|EFX'),\r\n SSN: application.quoteAppData.applicationsDataAnswered.personalInfo.ssnHashed,\r\n }\r\n\r\n await api.cbc.checkFrozen(req).then(response => {\r\n experianFrozen = response.data.experianFrozen\r\n transUnionFrozen = response.data.transUnionFrozen\r\n equifaxFrozen = response.data.equifaxFrozen\r\n\r\n if (response.data.success) {\r\n application.quoteAppData.applicationsDataAnswered.personalInfo.lastSuccessfulCreditCheck = new Date();\r\n }\r\n }).finally(() => {\r\n application.quoteAppData.applicationsDataAnswered.personalInfo.freezeWithExperian = experianFrozen\r\n application.quoteAppData.applicationsDataAnswered.personalInfo.freezeWithTransUnion = transUnionFrozen\r\n application.quoteAppData.applicationsDataAnswered.personalInfo.freezeWithEquifax = equifaxFrozen\r\n })\r\n }\r\n}\r\n\r\n\r\nfunction shouldWeCheckCredit(application) {\r\n if (!application.quoteAppData.applicationsDataAnswered.personalInfo.lastSuccessfulCreditCheck) {\r\n return true\r\n }\r\n\r\n let lastTime = moment(application.quoteAppData.applicationsDataAnswered.personalInfo.lastSuccessfulCreditCheck, \"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\")\r\n return Math.abs(moment().diff(lastTime, 'hours')) >= 24;\r\n}\r\n\r\n// Convert an enum string back to its enum type:\r\nfunction reportTypeStringToEnum(inputString) {\r\n switch (inputString.toUpperCase()) {\r\n case 'XPN':\r\n return ENUMS.CBC_REPORT_TYPES.XPN\r\n case 'TU':\r\n return ENUMS.CBC_REPORT_TYPES.TU\r\n case 'EFX':\r\n return ENUMS.CBC_REPORT_TYPES.EFX\r\n case 'XPN|TU':\r\n return ENUMS.CBC_REPORT_TYPES.XPN_TU\r\n case 'XPN|EFX':\r\n return ENUMS.CBC_REPORT_TYPES.XPN_EFX\r\n case 'TU|EFX':\r\n return ENUMS.CBC_REPORT_TYPES.TU_EFX\r\n case 'XPN|TU|EFX':\r\n return ENUMS.CBC_REPORT_TYPES.XPN_TU_EFX\r\n }\r\n}","import api from \"@core/services/api\";\r\nimport util from \"@core/services/util\";\r\nimport ENUMS from \"@core/classes/Enums\";\r\n\r\nconst DropdownHelper = {\r\n /// Label will say \"Default\" when no state is given\r\n getLenders: async () => {\r\n return await DropdownHelper.$cache.getSet(\"GET_LENDERS\", async () => {\r\n let data = null;\r\n\r\n let apiResponse = await api.settings.getLenders();\r\n if (apiResponse && apiResponse.data) {\r\n return apiResponse.data;\r\n }\r\n return data;\r\n });\r\n },\r\n\r\n getDealTypes: async () => {\r\n return await DropdownHelper.$cache.getSet(\"GET_DEAL_TYPES\", async () => {\r\n return [\"FINANCE\", \"LEASE\", \"CASH\"].map(c => ({\r\n value: c,\r\n display: c,\r\n }));\r\n });\r\n },\r\n\r\n getInventoryTypes: async () => {\r\n return await DropdownHelper.$cache.getSet(\"GET_INVENTORY_TYPES\", async () => [\"New\", \"Used\", \"Certified\"]);\r\n },\r\n\r\n getBrands: async (forceRefresh = false) => {\r\n return await DropdownHelper.$cache.getSet(\r\n \"GET_BRANDS_DROPDOWN\",\r\n async () => {\r\n let data = null;\r\n let apiResponse = await api.settings.getBrands();\r\n if (apiResponse && apiResponse.data) {\r\n data = apiResponse.data.map(c => {\r\n return {\r\n value: c,\r\n display: c.brandName,\r\n };\r\n });\r\n }\r\n return data;\r\n },\r\n forceRefresh,\r\n );\r\n },\r\n getModels: async (forceRefresh = false) => {\r\n return await DropdownHelper.$cache.getSet(\r\n \"GET_MODELS_DROPDOWN\",\r\n async () => {\r\n let data = null;\r\n let apiResponse = await api.settings.getModels();\r\n if (apiResponse && apiResponse.data) {\r\n data = apiResponse.data.map(c => {\r\n return {\r\n value: c,\r\n display: c.modelName,\r\n };\r\n });\r\n }\r\n return data;\r\n },\r\n forceRefresh,\r\n );\r\n },\r\n getCarCalcsTitleIdsDropDown: async () => {\r\n return await DropdownHelper.$cache.getSet(\"GET_CARCALCS_TITLEIDS_DROPDOWN\", async () => {\r\n let dropdownData = null;\r\n let apiResponse = await api.utilities.getCarCalcsTitleIds();\r\n console.log(apiResponse);\r\n if (apiResponse && apiResponse.data) {\r\n dropdownData = apiResponse.data.map(c => {\r\n return {\r\n value: c.titleId,\r\n display: `${c.titleId} - ${c.name}${c.alternativeNames ? \" - \" + c.alternativeNames : \"\"}`,\r\n };\r\n });\r\n }\r\n return dropdownData;\r\n });\r\n },\r\n getAdditionTypes: () => {\r\n return ENUMS.ADDITION_TYPES.toList();\r\n },\r\n getValidationListForCBCList: () => {\r\n return [\r\n \"Driver's License\",\r\n \"Passport\",\r\n \"Social Security Card\",\r\n \"Vehicle Title/Reg\",\r\n \"Utility Bill\",\r\n \"Credit Thawed/Unfrozen\",\r\n \"Other\",\r\n ];\r\n },\r\n\r\n getCBCCredVersions: () => {\r\n let disabledList = ENUMS.CBC_CREDIT_PULL_VERSIONS_FICO.toList().map(vr =>\r\n vr.text.includes(\"--\") ? { ...vr, disabled: true } : { ...vr, disabled: false },\r\n );\r\n\r\n // lets separate the groups in between the disabled: true (these are separators for the dropdown)\r\n let groups = [];\r\n let currentGroup = [];\r\n\r\n disabledList.forEach(item => {\r\n if (item.disabled) {\r\n // If there are items in the current group, add it to groups\r\n if (currentGroup.length > 0) {\r\n groups.push(currentGroup);\r\n currentGroup = [];\r\n }\r\n // Start a new group with the disabled item\r\n groups.push([item]);\r\n } else {\r\n // Add item to the current group\r\n currentGroup.push(item);\r\n }\r\n });\r\n\r\n if (currentGroup.length > 0) {\r\n groups.push(currentGroup);\r\n }\r\n\r\n // Per request, sorting the List based on the numbers, so the highest number in the credit report version type will be displayed first\r\n let sortedGroups = groups.map(group => {\r\n // Check if the group is not just a separator\r\n if (group.length > 1 || !group[0].disabled) {\r\n return group.sort((a, b) => {\r\n // Extract numbers from the text of a and b\r\n const numA = util.extractNumber(a.text);\r\n const numB = util.extractNumber(b.text);\r\n return numB - numA; // Sort in descending order\r\n });\r\n }\r\n return group; // Return the group unchanged if it's just a disabled item\r\n });\r\n\r\n return sortedGroups.flat();\r\n },\r\n\r\n getCBCCredVersionsForStoreSettings: () => {\r\n let disabledList = ENUMS.CBC_CREDIT_PULL_VERSIONS_FICO.toList().map(vr =>\r\n vr.text.includes(\"--\") ? { ...vr, disabled: true } : { ...vr, disabled: false },\r\n );\r\n\r\n // Remove the disabled ones from the list\r\n let enabledList = disabledList.filter(item => !item.disabled);\r\n\r\n // Function to extract the group abbreviation from the text\r\n const getAbbreviation = text => {\r\n if (text.includes(\"EFX\")) return \"EFX\"; // Example: \"FICO Auto 5 EFX N\"\r\n if (text.includes(\"XPN\")) return \"XPN\"; // Example: \"FICO Auto V2 XPN\"\r\n if (text.includes(\"TU\")) return \"TU\"; // Example: \"FICO Auto Score 4 TU\"\r\n // Add more conditions for other groups as needed\r\n return \"\"; // Default value\r\n };\r\n\r\n // Add abbreviation field to each item\r\n enabledList.forEach(item => {\r\n item.abbreviation = getAbbreviation(item.text);\r\n });\r\n\r\n // Let's separate the groups in between the disabled: true (these are separators for the dropdown)\r\n let groups = [];\r\n let currentGroup = [];\r\n\r\n enabledList.forEach(item => {\r\n if (currentGroup.length > 0 && item.text.includes(\"--\")) {\r\n groups.push(currentGroup);\r\n currentGroup = [];\r\n }\r\n currentGroup.push(item);\r\n });\r\n\r\n if (currentGroup.length > 0) {\r\n groups.push(currentGroup);\r\n }\r\n\r\n // Per request, sorting the List based on the numbers, so the highest number in the credit report version type will be displayed first\r\n let sortedGroups = groups.map(group => {\r\n // Check if the group is not just a separator\r\n if (group.length > 1 || !group[0].disabled) {\r\n return group.sort((a, b) => {\r\n // Extract numbers from the text of a and b\r\n const numA = util.extractNumber(a.text);\r\n const numB = util.extractNumber(b.text);\r\n return numB - numA; // Sort in descending order\r\n });\r\n }\r\n return group; // Return the group unchanged if it's just a disabled item\r\n });\r\n\r\n // Flatten the sorted groups array into a single array\r\n let flattenedList = sortedGroups.reduce((acc, val) => acc.concat(val), []);\r\n\r\n return flattenedList;\r\n },\r\n\r\n getValidationListForDOB: () => {\r\n return [\"Driver's License\", \"Passport\", \"Other\"];\r\n },\r\n getValidationListForSSN: () => {\r\n return [\"Passport\", \"Social Security Card\", \"Other\"];\r\n },\r\n getValidationListForAddress: () => {\r\n return [\"Driver's License\", \"Passport\", \"Vehicle Title/Reg\", \"Utility Bill\", \"Other\"];\r\n },\r\n getValidationListForFraud: () => {\r\n return [\"Driver's License\", \"Passport\", \"Social Security Card\", \"Credit Thawed/Unfrozen\", \"Other\"];\r\n },\r\n\r\n getRouteOneTaxesList: () => {\r\n return [\r\n \"luxuryTax\",\r\n \"salesTax\",\r\n \"totalSalesUseTax\",\r\n \"securityDepositTax\",\r\n \"capCostReductionTax\",\r\n \"monthlyUseTax\",\r\n \"documentStampTax\",\r\n \"motorVehicleTax\",\r\n \"upfrontFeeTax\",\r\n \"vehicleInventoryTax\",\r\n \"exciseTax\",\r\n \"wheelTax\",\r\n \"localOptionSalesTax\",\r\n \"localOption\",\r\n \"countyTax\",\r\n \"taxNotIncludedInCashPrice\",\r\n \"taxNotIncludedInCashPrice2\",\r\n \"taxNotIncludedInCashPrice3\",\r\n \"singleArticleTax\",\r\n \"propertyTax\",\r\n \"otherTax\",\r\n \"titleAdValoremTax\",\r\n \"grossReceiptsTax\",\r\n \"serviceContractTax\",\r\n ];\r\n },\r\n getRouteOneFeesList: () => {\r\n return [\r\n \"acquisitionFee\",\r\n \"administrationFee\",\r\n \"arbitrationFee\",\r\n \"batteryFee\",\r\n \"convenienceFee\",\r\n \"dealerProcessingFee\",\r\n \"deliveryHandlingFee\",\r\n \"deputyServicFeePaidToDealer\",\r\n \"deqServiceFee\",\r\n \"documentFee\",\r\n \"electronicFilingFee\",\r\n \"emissionInspectionFee\",\r\n \"filingFee\",\r\n \"lenderMemberFee\",\r\n \"licenseFee\",\r\n \"lienNotationFee\",\r\n \"motorVehicleInspectionFee\",\r\n \"officialFees\",\r\n \"otherFees\",\r\n \"plateFee\",\r\n \"processingFee\",\r\n \"registrationFee\",\r\n \"safetyInspectionFee\",\r\n \"securityInterestChargesFilingFee\",\r\n \"serviceHandlingFee\",\r\n \"smogCertificationPaidToSeller\",\r\n \"smogCertificationPaidToState\",\r\n \"smogExpemptionDonatonFee\",\r\n \"suplamentalTitleFee\",\r\n \"tireFee\",\r\n \"titleRegistrationProcessingFee\",\r\n \"titleFee\",\r\n \"transferFee\",\r\n \"officialFees2\",\r\n \"officialFees3\",\r\n \"dispositionFee\",\r\n \"ERTFee\",\r\n \"messengerFee\",\r\n \"motorVehicleWarrantyTrustFundFee\",\r\n \"notaryFee\",\r\n \"purchaseOptionFee\",\r\n \"rentalSurchargeFee\",\r\n \"temporaryTagFee\",\r\n \"totalFees\",\r\n \"freightFee\",\r\n \"georgiaMotorVehicleWarrantyRightsActFee\",\r\n \"loanOriginationFee\",\r\n \"nonFilingInsuranceFee\",\r\n \"onlineRegistrationFee\",\r\n \"roadAndBridgeFee\",\r\n \"buyersTagFee\",\r\n \"childSafetySeatFee\",\r\n \"emergencyMedicalServiceAdministrationFee\",\r\n \"exemptionFee\",\r\n \"infrastructureMaintenanceFee\",\r\n \"localFee\",\r\n \"electronicTempTagProcessingFee\",\r\n \"uDriveItFee\",\r\n \"airQualityFee\",\r\n \"courtesyDeliveryFee\",\r\n \"exemptionFee\",\r\n \"titlePrepFee\",\r\n \"monthlyLocalFee\",\r\n \"motorVehicleInspectionFeePaidToStation\",\r\n ];\r\n },\r\n getDocumentPacketCategories: async () => {\r\n return await DropdownHelper.$cache.getSet(\r\n \"DOCUMENT_PACKET_CATEGORIES\",\r\n async () => {\r\n let data = null;\r\n\r\n const response = await api.utilities.getPaperworkCategories();\r\n const paperworkCategories = response.data.sort((a, b) => a.orderIndex - b.orderIndex);\r\n\r\n if (paperworkCategories) {\r\n data = paperworkCategories.map(c => {\r\n return {\r\n value: c,\r\n display: c.description,\r\n };\r\n });\r\n }\r\n return data;\r\n },\r\n true,\r\n );\r\n },\r\n getProfitFlags: () => {\r\n return ENUMS.PROFIT_FLAGS.toList();\r\n },\r\n getVehicleDeliveryMethods: () => {\r\n return ENUMS.VEHICLE_DELIVERY_METHODS.toList();\r\n },\r\n $cache: {\r\n getSet: async (CACHE_KEY, dataFunction, forceRefresh = false) => {\r\n //CHECK IF WE HAVE IT IN CACHE\r\n let dropdownData = null;\r\n if (forceRefresh == false) {\r\n let dropdownData = DropdownHelper.$cache.get(CACHE_KEY) ?? null;\r\n\r\n if (dropdownData) {\r\n return dropdownData;\r\n }\r\n }\r\n\r\n //CALL THE SERVER - GET NEW DATA\r\n dropdownData = await dataFunction();\r\n if (dropdownData) {\r\n //SAVE TO CACHE\r\n DropdownHelper.$cache.set(CACHE_KEY, dropdownData);\r\n }\r\n\r\n return dropdownData;\r\n },\r\n get: key => {\r\n let currDate = new Date();\r\n let cachedItem = DropdownHelper.$cache.items[key] ?? null;\r\n if (cachedItem && cachedItem.exp > currDate) return cachedItem.data;\r\n else return null;\r\n },\r\n set: (key, data, expirationInMinutes = 30) => {\r\n let expirationDate = new Date();\r\n expirationDate = expirationDate.setTime(expirationDate.getTime() + expirationInMinutes * 60 * 1000);\r\n\r\n let newCacheItem = {\r\n key: key,\r\n data: data,\r\n exp: expirationDate,\r\n };\r\n\r\n DropdownHelper.$cache.items[key] = newCacheItem;\r\n },\r\n items: {},\r\n },\r\n};\r\n\r\nexport default DropdownHelper;\r\n","import api from \"@core/services/api\";\r\nimport ENUMS from \"@core/classes/Enums\";\r\nimport moment from 'moment'\r\nimport util from '@core/services/util'\r\nimport MapsService from '@core/services/maps'\r\nimport DropdownHelper from '@core/helpers/dropdown-helper'\r\nimport settings from 'settings'\r\n\r\n\r\nexport function prefixList(keys, language, application, toggleLoadingQuestion) {\r\n const prefixList = [\r\n { value: 'Dr.', English: 'Dr.', Spanish: 'Dr(a).' },\r\n { value: 'Mr.', English: 'Mr.', Spanish: 'Sr.' },\r\n { value: 'Mrs.', English: 'Mrs.', Spanish: 'Sra.' },\r\n { value: 'Ms.', English: 'Ms.', Spanish: 'Srta.' },\r\n { value: 'Mx.', English: 'Mx.', Spanish: 'Sx.' }\r\n ]\r\n\r\n let dropdownDataList = []\r\n\r\n prefixList.forEach(d => {\r\n dropdownDataList.push({ [keys.text]: d[language], [keys.value]: d.value })\r\n })\r\n\r\n return dropdownDataList\r\n}\r\n\r\nexport function suffixList(keys, language, application, toggleLoadingQuestion) {\r\n const suffixList = [\r\n { value: 'Jr.', English: 'Jr.', Spanish: 'Jr.' },\r\n { value: 'Sr.', English: 'Sr.', Spanish: 'Sr.' },\r\n { value: 'II', English: 'II', Spanish: 'II' },\r\n { value: 'III', English: 'III', Spanish: 'III' },\r\n { value: 'IV', English: 'IV', Spanish: 'IV' },\r\n { value: 'other', English: 'Other', Spanish: 'Otro' }\r\n ]\r\n\r\n let dropdownDataList = []\r\n\r\n suffixList.forEach(d => {\r\n dropdownDataList.push({ [keys.text]: d[language], [keys.value]: d.value })\r\n })\r\n\r\n return dropdownDataList\r\n}\r\n\r\nexport function usStatesList(keys, language, application, toggleLoadingQuestion) {\r\n let dropdownDataList = []\r\n\r\n ENUMS.states.forEach(s => {\r\n dropdownDataList.push({ [keys.text]: s.description, [keys.value]: s.code })\r\n })\r\n\r\n return dropdownDataList\r\n}\r\n\r\nexport function countries(keys, language, application, toggleLoadingQuestion) {\r\n let languageCode = \"en\"\r\n if (language == \"Spanish\") {\r\n languageCode = \"es\"\r\n }\r\n\r\n let countries = settings.countries\r\n let dropdownDataList = []\r\n\r\n countries?.forEach(c => {\r\n let text = c.nameTranslations.find(n => n.languageCode == languageCode).value\r\n let value = c.countryCode\r\n\r\n if (value != \"US\") {\r\n dropdownDataList.push({ [keys.text]: text, [keys.value]: value })\r\n }\r\n })\r\n\r\n return dropdownDataList\r\n}\r\n\r\nexport function howManyVehicles(keys, language, application, toggleLoadingQuestion) {\r\n const vehicleOwnershipType = [\r\n { value: 0, English: '0', Spanish: '0' },\r\n { value: 1, English: '1', Spanish: '1' },\r\n { value: 2, English: '2', Spanish: '2' },\r\n { value: 3, English: '3+', Spanish: '3+' },\r\n ]\r\n\r\n let dropdownDataList = []\r\n\r\n vehicleOwnershipType.forEach(v => {\r\n dropdownDataList.push({ [keys.text]: v[language], [keys.value]: v.value })\r\n })\r\n\r\n return dropdownDataList\r\n}\r\n\r\nexport function vehicleOwnershipType(keys, language, application, toggleLoadingQuestion) {\r\n const vehicleOwnershipType = [\r\n { value: 'own', English: 'Own', Spanish: 'Posee' },\r\n { value: 'lease', English: 'Lease', Spanish: 'Arrienda' },\r\n { value: 'finance', English: 'Finance', Spanish: 'Financia' },\r\n ]\r\n\r\n let dropdownDataList = []\r\n\r\n vehicleOwnershipType.forEach(v => {\r\n dropdownDataList.push({ [keys.text]: v[language], [keys.value]: v.value })\r\n })\r\n\r\n return dropdownDataList\r\n}\r\n\r\n//Info is not being saved in the application so we can't get the condition to show there.\r\n//export function vehiclePlateVin(keys, language, application, toggleLoadingQuestion) {\r\n// const vehicleOwnershipType = [\r\n// { value: 'plate', English: 'License Plate', Spanish: 'Nรบmero de Placa' },\r\n// { value: 'vin', English: 'Vehicle Identification # (VIN)', Spanish: 'Identificaciรณn del vehรญculo (VIN)' },\r\n// { value: 'neither', English: 'Neither', Spanish: 'Ninguno' },\r\n// ]\r\n\r\n// let dropdownDataList = []\r\n\r\n// vehicleOwnershipType.forEach(v => {\r\n// dropdownDataList.push({ [keys.text]: v[language], [keys.value]: v.value })\r\n// })\r\n\r\n// return dropdownDataList\r\n//}\r\n\r\nexport function vehicleWhoOwnsIt(keys, language, application, toggleLoadingQuestion) {\r\n const data = [\r\n { value: 'myself', English: 'Myself', Spanish: 'Yo' },\r\n { value: 'spouse', English: 'Spouse', Spanish: 'Cรณnyuge' },\r\n { value: 'child', English: 'Child', Spanish: 'Hijo(a)' },\r\n { value: 'parents', English: 'Parents', Spanish: 'Padres' },\r\n { value: 'other', English: 'Other', Spanish: 'Otro' },\r\n ]\r\n\r\n let dropdownDataList = []\r\n\r\n data.forEach(d => {\r\n dropdownDataList.push({ [keys.text]: d[language], [keys.value]: d.value })\r\n })\r\n\r\n return dropdownDataList\r\n}\r\n\r\nexport async function vehicleMake(keys, language, application, toggleLoadingQuestion) {\r\n toggleLoadingQuestion()\r\n\r\n //MarketScan List\r\n let makeList = await DropdownHelper.getBrands()\r\n console.log(\"carMakeList\", makeList);\r\n\r\n let makes = []\r\n\r\n makeList.forEach(m => {\r\n makes.push({ [keys.text]: m.display, [keys.value]: m.display })\r\n })\r\n\r\n let rebateVehicleMake = application.quoteAppData.questions.find(q => q.key == application.quoteAppData.currentQuestion)?.savedAnswer\r\n\r\n if (rebateVehicleMake) {\r\n let makeFoundIndex = makes.findIndex(m => m[keys.text].toLowerCase() == rebateVehicleMake.toLowerCase())\r\n\r\n if (makeFoundIndex >= 0 && !makes.find(m => m[keys.text] == rebateVehicleMake)) {\r\n application.quoteAppData.questions.find(q => q.key == application.quoteAppData.currentQuestion).savedAnswer = makes[makeFoundIndex][keys.text]\r\n }\r\n }\r\n\r\n ////Chrome List\r\n //let yearIndex = application.quoteAppData.currentQuestion.split(\"-\")[1]\r\n //let year = null\r\n //if (application.quoteAppData.currentQuestion.toLowerCase().includes('current')) {\r\n // year = parseInt(application.quoteAppData.applicationsDataAnswered.rebates.rebateCurrentVehicles.vehicles[yearIndex].vehicleYear)\r\n //}\r\n //else {\r\n // year = parseInt(application.quoteAppData.applicationsDataAnswered.rebates.rebateReturnedLeaseVehicles.vehicles[yearIndex].vehicleYear)\r\n //}\r\n\r\n //let makeList = await api.carMakeList(year)\r\n //console.log(\"carMakeList\", makeList?.data);\r\n //let makes = []\r\n\r\n //makeList.data.forEach(m => {\r\n // makes.push({ [keys.text]: m.value, [keys.value]: m.value })\r\n //})\r\n\r\n //let rebateVehicleMake = application.quoteAppData.questions.find(q => q.key == application.quoteAppData.currentQuestion)?.savedAnswer\r\n //console.log(\"rebateVehicleMake\", rebateVehicleMake);\r\n\r\n //if (rebateVehicleMake) {\r\n // let makeFoundIndex = makes.findIndex(m => m[keys.text].toLowerCase() == rebateVehicleMake.toLowerCase())\r\n // console.log(\"makeFoundIndex\", makeFoundIndex);\r\n\r\n // if (makeFoundIndex >= 0 && !makes.find(m => m[keys.text] == rebateVehicleMake)) {\r\n // console.log(\"UPDATE VALUE IF STATEMENT\", makes[makeFoundIndex][keys.text]);\r\n // application.quoteAppData.questions.find(q => q.key == application.quoteAppData.currentQuestion).savedAnswer = makes[makeFoundIndex][keys.text]\r\n // }\r\n //}\r\n\r\n toggleLoadingQuestion()\r\n\r\n return makes\r\n}\r\n\r\nexport async function vehicleModel(keys, language, application, toggleLoadingQuestion) {\r\n\r\n toggleLoadingQuestion()\r\n\r\n //MarketScan List\r\n let makeList = await DropdownHelper.getBrands()\r\n let makeIdIndex = application.quoteAppData.currentQuestion.split(\"-\")[1]\r\n\r\n let makeId = null\r\n if (application.quoteAppData.currentQuestion.toLowerCase().includes('current')) {\r\n console.log(\"CURRENT\", makeIdIndex);\r\n makeId = makeList.find(m => m.display == application.quoteAppData.applicationsDataAnswered.rebates.rebateCurrentVehicles.vehicles[makeIdIndex].vehicleMake).value.saturnBrandId\r\n console.log(\"makeID\", makeId);\r\n }\r\n else {\r\n console.log(\"RETURNED\", makeIdIndex);\r\n makeId = makeList.find(m => m.display == application.quoteAppData.applicationsDataAnswered.rebates.rebateReturnedLeaseVehicles.vehicles[makeIdIndex].vehicleMake).value.saturnBrandId\r\n console.log(\"makeID\", makeId);\r\n }\r\n\r\n let modelsList = await DropdownHelper.getModels()\r\n console.log(\"modelsList\", modelsList);\r\n\r\n let models = []\r\n\r\n modelsList.forEach(ml => {\r\n if (ml.value.saturnBrandId == makeId) {\r\n models.push({ [keys.text]: ml.display, [keys.value]: ml.display })\r\n }\r\n })\r\n console.log(\"models\", models);\r\n\r\n let rebateVehicleModel = application.quoteAppData.questions.find(q => q.key == application.quoteAppData.currentQuestion)?.savedAnswer\r\n\r\n if (rebateVehicleModel) {\r\n let modelFoundIndex = models.findIndex(m => m[keys.text].toLowerCase() == rebateVehicleModel.toLowerCase())\r\n\r\n if (modelFoundIndex >= 0 && !models.find(m => m[keys.text] == rebateVehicleModel)) {\r\n application.quoteAppData.questions.find(q => q.key == application.quoteAppData.currentQuestion).savedAnswer = models[modelFoundIndex][keys.text]\r\n }\r\n }\r\n\r\n ////Chrome List\r\n //let yearIndex = application.quoteAppData.currentQuestion.split(\"-\")[1]\r\n //let year = null\r\n //if (application.quoteAppData.currentQuestion.toLowerCase().includes('current')) {\r\n // year = parseInt(application.quoteAppData.applicationsDataAnswered.rebates.rebateCurrentVehicles.vehicles[yearIndex].vehicleYear)\r\n //}\r\n //else {\r\n // year = parseInt(application.quoteAppData.applicationsDataAnswered.rebates.rebateReturnedLeaseVehicles.vehicles[yearIndex].vehicleYear)\r\n //}\r\n\r\n //let makeList = await api.carMakeList(year)\r\n //let makeIdIndex = application.quoteAppData.currentQuestion.split(\"-\")[1]\r\n\r\n //let makeId = null\r\n //if (application.quoteAppData.currentQuestion.toLowerCase().includes('current')) {\r\n // console.log(\"CURRENT\", makeIdIndex);\r\n // makeId = makeList.data?.find(m => m.value == application.quoteAppData.applicationsDataAnswered.rebates.rebateCurrentVehicles.vehicles[makeIdIndex].vehicleMake).id\r\n // console.log(\"makeID\", makeId);\r\n //}\r\n //else {\r\n // console.log(\"RETURNED\");\r\n // makeId = makeList.data?.find(m => m.value == application.quoteAppData.applicationsDataAnswered.rebates.rebateReturnedLeaseVehicles.vehicles[makeIdIndex].vehicleMake).id\r\n // console.log(\"makeID\", makeId);\r\n //}\r\n\r\n //let modelsList = await api.carModelList(year, makeId)\r\n //console.log(\"carModelList\", modelsList?.data);\r\n\r\n //let models = []\r\n\r\n //modelsList.data?.forEach(ml => {\r\n // if (!models.find(m => m.value == ml.value)) {\r\n\r\n // models.push({ [keys.text]: ml.value, [keys.value]: ml.value })\r\n // }\r\n //})\r\n\r\n //let rebateVehicleModel = application.quoteAppData.questions.find(q => q.key == application.quoteAppData.currentQuestion)?.savedAnswer\r\n\r\n //if (rebateVehicleModel) {\r\n // let modelFoundIndex = models.findIndex(m => m[keys.text].toLowerCase() == rebateVehicleModel.toLowerCase())\r\n\r\n // if (!models.find(m => m[keys.text] == rebateVehicleModel)) {\r\n // if (modelFoundIndex >= 0) {\r\n // application.quoteAppData.questions.find(q => q.key == application.quoteAppData.currentQuestion).savedAnswer = models[modelFoundIndex][keys.text]\r\n // }\r\n // else {\r\n // models.push({ [keys.text]: rebateVehicleModel, [keys.value]: rebateVehicleModel })\r\n // }\r\n // }\r\n //}\r\n\r\n toggleLoadingQuestion()\r\n\r\n return models\r\n}\r\n\r\nexport function militaryBranch(keys, language, application, toggleLoadingQuestion) {\r\n const data = [\r\n { value: 'army', English: 'Army', Spanish: 'Ejรฉrcito' },\r\n { value: 'navy', English: 'Navy', Spanish: 'Marina de Guerra' },\r\n { value: 'airForce', English: 'Air Force', Spanish: 'Fuerza Aerea' },\r\n { value: 'nationalGuard', English: 'National Guard', Spanish: 'Guardia Nacional' },\r\n { value: 'marines', English: 'Marines', Spanish: 'Infanterรญa de Marina' },\r\n { value: 'coastGuard', English: 'Coast Guard', Spanish: 'Guardia Costera' },\r\n ]\r\n\r\n let dropdownDataList = []\r\n\r\n data.forEach(d => {\r\n dropdownDataList.push({ [keys.text]: d[language], [keys.value]: d.value })\r\n })\r\n\r\n return dropdownDataList\r\n}\r\n\r\nexport function whoIsMilitary(keys, language, application, toggleLoadingQuestion) {\r\n const data = [\r\n { value: 'me', English: 'Me', Spanish: 'Yo' },\r\n { value: 'spouse', English: 'Spouse', Spanish: 'Cรณnyuge' },\r\n { value: 'both', English: 'Both', Spanish: 'Ambos' },\r\n { value: 'noOne', English: 'Neither', Spanish: 'Ninguno' },\r\n ]\r\n\r\n let dropdownDataList = []\r\n\r\n data.forEach(d => {\r\n dropdownDataList.push({ [keys.text]: d[language], [keys.value]: d.value })\r\n })\r\n\r\n return dropdownDataList\r\n}\r\n\r\nexport function militaryStatus(keys, language, application, toggleLoadingQuestion) {\r\n const data = [\r\n { value: 'active', English: 'Active', Spanish: 'Activo(a)' },\r\n { value: 'veteran', English: 'Veteran', Spanish: 'Veterano(a)' },\r\n { value: 'inactive', English: 'Inactive', Spanish: 'Inactivo(a)' },\r\n { value: 'reservist', English: 'Reservist', Spanish: 'Reserva' },\r\n ]\r\n\r\n let dropdownDataList = []\r\n\r\n data.forEach(d => {\r\n dropdownDataList.push({ [keys.text]: d[language], [keys.value]: d.value })\r\n })\r\n\r\n return dropdownDataList\r\n}\r\n\r\nexport function studentStatus(keys, language, application, toggleLoadingQuestion) {\r\n const data = [\r\n { value: 'fullTime', English: 'Full-Time', Spanish: 'Tiempo completo' },\r\n { value: 'partTime', English: 'Part-Time', Spanish: 'Medio Tiempo' },\r\n { value: 'graduated', English: 'Graduated', Spanish: 'Graduado(a)' },\r\n { value: 'academicLeave', English: 'Enrolled in Academic Leave', Spanish: 'De Licencia Acadรฉmica' },\r\n ]\r\n\r\n let dropdownDataList = []\r\n\r\n data.forEach(d => {\r\n dropdownDataList.push({ [keys.text]: d[language], [keys.value]: d.value })\r\n })\r\n\r\n return dropdownDataList\r\n}\r\n\r\nexport function institutionType(keys, language, application, toggleLoadingQuestion) {\r\n const data = [\r\n { value: 'highSchool', English: 'High School', Spanish: 'Preparatoria / Tรฉcnico Medio' },\r\n { value: 'college', English: 'College', Spanish: 'Colegio Universitario' },\r\n { value: 'university', English: 'University', Spanish: 'Universidad' },\r\n { value: 'tradeSchool', English: 'Trade School', Spanish: 'Escuela Tรฉcnico' },\r\n { value: 'registeredNursingSchool', English: 'Registered Nursing School', Spanish: 'Escuela de Enfermerรญa Registrada' },\r\n { value: 'nursingSchool', English: 'Nursing School', Spanish: 'Escuela de Enfermerรญa' },\r\n ]\r\n\r\n let dropdownDataList = []\r\n\r\n data.forEach(d => {\r\n dropdownDataList.push({ [keys.text]: d[language], [keys.value]: d.value })\r\n })\r\n\r\n return dropdownDataList\r\n}\r\n\r\nexport function estimatedCreditScore(keys, language, application, toggleLoadingQuestion) {\r\n const data = [\r\n { value: 'poorCredit', English: \"Under 579\", Spanish: \"Menos de 579\" },\r\n { value: 'fairCredit', English: \"580 - 669\", Spanish: \"580 - 669\" },\r\n { value: 'goodCredit', English: \"670 - 739\", Spanish: \"670 - 739\" },\r\n { value: 'veryGoodCredit', English: \"740 - 799\", Spanish: \"740 - 799\" },\r\n { value: 'excelentCredit', English: \"Over 800\", Spanish: \"Mรกs de 800\" },\r\n { value: 'dontknowCredit', English: \"Don't know\", Spanish: \"No lo sรฉ\" },\r\n ]\r\n\r\n let dropdownDataList = []\r\n\r\n data.forEach(d => {\r\n dropdownDataList.push({ [keys.text]: d[language], [keys.value]: d.value })\r\n })\r\n\r\n return dropdownDataList\r\n}\r\n\r\nexport function enterpriseTypes(keys, language, application, toggleLoadingQuestion) {\r\n const data = [\r\n { value: 'corporation', English: 'Corporation', Spanish: 'Corporaciรณn' },\r\n { value: 'llc', English: 'LLC', Spanish: 'SRL' },\r\n { value: 'partnership', English: 'Partnership', Spanish: 'Sociedad' },\r\n { value: 'proprietor', English: 'Proprietor', Spanish: 'Propietario' },\r\n ]\r\n\r\n let dropdownDataList = []\r\n\r\n data.forEach(d => {\r\n dropdownDataList.push({ [keys.text]: d[language], [keys.value]: d.value })\r\n })\r\n\r\n return dropdownDataList\r\n}\r\n\r\nexport function businessLocationOwnershipStatus(keys, language, application, toggleLoadingQuestion) {\r\n const data = [\r\n { value: 'mortgage', English: 'Mortgage', Spanish: 'Hipotecada' },\r\n { value: 'rental', English: 'Rental', Spanish: 'Alquilada' },\r\n { value: 'own', English: 'Own', Spanish: 'Propia' },\r\n ]\r\n\r\n let dropdownDataList = []\r\n\r\n data.forEach(d => {\r\n dropdownDataList.push({ [keys.text]: d[language], [keys.value]: d.value })\r\n })\r\n\r\n return dropdownDataList\r\n}\r\n\r\nexport function residenceOwnershipStatus(keys, language, application, toggleLoadingQuestion) {\r\n const data = [\r\n { value: 'mortgage', English: 'Mortgage', Spanish: 'Hipoteca' },\r\n { value: 'rental', English: 'Rental', Spanish: 'Alquiler' },\r\n { value: 'own', English: 'Own', Spanish: 'Propietario' },\r\n { value: 'familyOther', English: 'Live with Family/Other', Spanish: 'Vivo con mi Familia/Otro' },\r\n ]\r\n\r\n let dropdownDataList = []\r\n\r\n data.forEach(d => {\r\n dropdownDataList.push({ [keys.text]: d[language], [keys.value]: d.value })\r\n })\r\n\r\n return dropdownDataList\r\n}\r\n\r\n//Info is not being saved in the application so we can't get the condition to show there.\r\n//export function insuranceAndTaxes(keys, language, application, toggleLoadingQuestion) {\r\n// const data = [\r\n// { value: 'insurance', English: 'Insurance', Spanish: 'Seguro' },\r\n// { value: 'taxes', English: 'Taxes', Spanish: 'Impuestos' },\r\n// { value: 'both', English: 'Both', Spanish: 'Ambos' },\r\n// { value: 'no', English: 'No', Spanish: 'No' },\r\n// ]\r\n// let dropdownDataList = []\r\n\r\n// data.forEach(d => {\r\n// dropdownDataList.push({ [keys.text]: d[language], [keys.value]: d.value })\r\n// })\r\n\r\n// return dropdownDataList\r\n//}\r\n\r\nexport function liveWithFamily(keys, language, application, toggleLoadingQuestion) {\r\n const data = [\r\n { value: 'parents', English: 'Parents', Spanish: 'Padres' },\r\n { value: 'siblings', English: 'Siblings', Spanish: 'Hermanos' },\r\n { value: 'other', English: 'Other', Spanish: 'Otro' },\r\n ]\r\n\r\n let dropdownDataList = []\r\n\r\n data.forEach(d => {\r\n dropdownDataList.push({ [keys.text]: d[language], [keys.value]: d.value })\r\n })\r\n\r\n return dropdownDataList\r\n}\r\n\r\nexport function employmentFormType(keys, language, application, toggleLoadingQuestion) {\r\n const data = [\r\n { value: 'w2', English: 'W2', Spanish: 'W2' },\r\n { value: '1099', English: '1099', Spanish: '1099' },\r\n ]\r\n let dropdownDataList = []\r\n\r\n data.forEach(d => {\r\n dropdownDataList.push({ [keys.text]: d[language], [keys.value]: d.value })\r\n })\r\n\r\n return dropdownDataList\r\n}\r\n\r\nexport function paymentType(keys, language, application, toggleLoadingQuestion) {\r\n const data = [\r\n { value: 'hourly', English: 'Hourly', Spanish: 'Por hora' },\r\n { value: 'salary', English: 'Salary', Spanish: 'Salario' },\r\n ]\r\n let dropdownDataList = []\r\n\r\n data.forEach(d => {\r\n dropdownDataList.push({ [keys.text]: d[language], [keys.value]: d.value })\r\n })\r\n\r\n return dropdownDataList\r\n}\r\n\r\nexport function noEmployedStatus(keys, language, application, toggleLoadingQuestion) {\r\n const data = [\r\n { value: 'retired', English: 'Retired', Spanish: 'Retirado(a)' },\r\n { value: 'disabled', English: 'Disabled', Spanish: 'Desabilitado(a)' },\r\n { value: 'student', English: 'Student', Spanish: 'Estudiante' },\r\n { value: 'unemployed', English: 'Unemployed', Spanish: 'Desempleado(a)' },\r\n { value: 'other', English: 'Other', Spanish: 'Otro' },\r\n ]\r\n\r\n let dropdownDataList = []\r\n\r\n data.forEach(d => {\r\n dropdownDataList.push({ [keys.text]: d[language], [keys.value]: d.value })\r\n })\r\n\r\n return dropdownDataList\r\n}\r\n\r\nexport function allFrequencies(keys, language, application, toggleLoadingQuestion) {\r\n const data = [\r\n { value: 'weekly', English: 'Weekly', Spanish: 'Semanalmente' },\r\n { value: 'biWeekly', English: 'BiWeekly', Spanish: 'Quincenalmente' },\r\n { value: 'monthly', English: 'Monthly', Spanish: 'Mensualmente' },\r\n { value: 'quarterly', English: 'Quarterly', Spanish: 'Trimestralmente' },\r\n { value: 'semiAnnual', English: 'Semi-Annual', Spanish: 'Semestralmente' },\r\n { value: 'annually', English: 'Annually', Spanish: 'Anualmente' },\r\n ]\r\n\r\n let dropdownDataList = []\r\n\r\n data.forEach(d => {\r\n dropdownDataList.push({ [keys.text]: d[language], [keys.value]: d.value })\r\n })\r\n\r\n return dropdownDataList\r\n}\r\n\r\nexport function monthlyAndAnnuallyFrequencies(keys, language, application, toggleLoadingQuestion) {\r\n let dropdownDataList = allFrequencies(keys, language, application, toggleLoadingQuestion).filter(f => f.value == 'monthly' || f.value == 'annually')\r\n\r\n return dropdownDataList\r\n}\r\n\r\nexport function frequenciesWithoutQuarterlyAndSemiAnnual(keys, language, application, toggleLoadingQuestion) {\r\n let dropdownDataList = allFrequencies(keys, language, application, toggleLoadingQuestion).filter(f => f.value != 'quarterly' && f.value != 'semiAnnual')\r\n\r\n return dropdownDataList\r\n}\r\n\r\nexport async function addresses(keys, language, application, searchText) {\r\n let zipCode = null\r\n let mapService = new MapsService();\r\n\r\n if (application.quoteAppData.currentQuestion == \"provideStreetAddress\") {\r\n zipCode = application.quoteAppData.applicationsDataAnswered.personalInfo.currentResidence.zipCode\r\n }\r\n else {\r\n zipCode = application.quoteAppData.applicationsDataAnswered.personalInfo.previousResidence.zipCode\r\n }\r\n\r\n if (searchText && searchText.length >= 3) {\r\n //FALL BACK ZIP CODE LOOK UP\r\n let zipCodeData = null\r\n let zipCodeResponse = await api.getZipcodeDetails(zipCode);\r\n console.log(\"ZIPPPPPP\", zipCodeResponse);\r\n if (zipCodeResponse && zipCodeResponse.data && zipCodeResponse.data.lat && zipCodeResponse.data.long) {\r\n zipCodeData = {\r\n zipcode: zipCodeResponse.data.zipCode,\r\n lat: zipCodeResponse.data.lat,\r\n lng: zipCodeResponse.data.long,\r\n city: zipCodeResponse.data.city,\r\n state: zipCodeResponse.data.state\r\n };\r\n }\r\n\r\n await mapService.searchAddresses(searchText, { description: '-- NOT LISTED --' }, zipCodeData);\r\n }\r\n\r\n return mapService.results\r\n}\r\n","import { isReactive, isReadonly, computed, unref, ref, watch, isRef, reactive, nextTick, inject, provide, getCurrentInstance, onBeforeMount, onBeforeUnmount } from 'vue-demi';\n\nfunction ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n enumerableOnly && (symbols = symbols.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n })), keys.push.apply(keys, symbols);\n }\n\n return keys;\n}\n\nfunction _objectSpread2(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = null != arguments[i] ? arguments[i] : {};\n i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {\n _defineProperty(target, key, source[key]);\n }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n\n return target;\n}\n\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nfunction unwrapObj(obj) {\n let ignoreKeys = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];\n return Object.keys(obj).reduce((o, k) => {\n if (ignoreKeys.includes(k)) return o;\n o[k] = unref(obj[k]);\n return o;\n }, {});\n}\nfunction isFunction(val) {\n return typeof val === 'function';\n}\nfunction isProxy(value) {\n return isReactive(value) || isReadonly(value);\n}\nfunction get(obj, stringPath, def) {\n let current = obj;\n const path = stringPath.split('.');\n\n for (let i = 0; i < path.length; i++) {\n if (!current[path[i]]) return def;\n current = current[path[i]];\n }\n\n return current;\n}\nfunction gatherBooleanGroupProperties(group, nestedResults, property) {\n return computed(() => {\n return group.some(path => {\n return get(nestedResults, path, {\n [property]: false\n })[property];\n });\n });\n}\nfunction gatherArrayGroupProperties(group, nestedResults, property) {\n return computed(() => {\n return group.reduce((all, path) => {\n const fetchedProperty = get(nestedResults, path, {\n [property]: false\n })[property] || [];\n return all.concat(fetchedProperty);\n }, []);\n });\n}\n\nfunction callRule(rule, value, siblingState, instance) {\n return rule.call(instance, unref(value), unref(siblingState), instance);\n}\n\nfunction normalizeValidatorResponse(result) {\n return result.$valid !== undefined ? !result.$valid : !result;\n}\n\nfunction createAsyncResult(rule, model, $pending, $dirty, _ref, $response, instance) {\n let {\n $lazy,\n $rewardEarly\n } = _ref;\n let watchTargets = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : [];\n let siblingState = arguments.length > 8 ? arguments[8] : undefined;\n let $lastInvalidState = arguments.length > 9 ? arguments[9] : undefined;\n let $lastCommittedOn = arguments.length > 10 ? arguments[10] : undefined;\n const $invalid = ref(!!$dirty.value);\n const $pendingCounter = ref(0);\n $pending.value = false;\n const $unwatch = watch([model, $dirty].concat(watchTargets, $lastCommittedOn), () => {\n if ($lazy && !$dirty.value || $rewardEarly && !$lastInvalidState.value && !$pending.value) {\n return;\n }\n\n let ruleResult;\n\n try {\n ruleResult = callRule(rule, model, siblingState, instance);\n } catch (err) {\n ruleResult = Promise.reject(err);\n }\n\n $pendingCounter.value++;\n $pending.value = !!$pendingCounter.value;\n $invalid.value = false;\n Promise.resolve(ruleResult).then(data => {\n $pendingCounter.value--;\n $pending.value = !!$pendingCounter.value;\n $response.value = data;\n $invalid.value = normalizeValidatorResponse(data);\n }).catch(error => {\n $pendingCounter.value--;\n $pending.value = !!$pendingCounter.value;\n $response.value = error;\n $invalid.value = true;\n });\n }, {\n immediate: true,\n deep: typeof model === 'object'\n });\n return {\n $invalid,\n $unwatch\n };\n}\n\nfunction createSyncResult(rule, model, $dirty, _ref2, $response, instance, siblingState, $lastInvalidState) {\n let {\n $lazy,\n $rewardEarly\n } = _ref2;\n\n const $unwatch = () => ({});\n\n const $invalid = computed(() => {\n if ($lazy && !$dirty.value || $rewardEarly && !$lastInvalidState.value) {\n return false;\n }\n\n let returnValue = true;\n\n try {\n const result = callRule(rule, model, siblingState, instance);\n $response.value = result;\n returnValue = normalizeValidatorResponse(result);\n } catch (err) {\n $response.value = err;\n }\n\n return returnValue;\n });\n return {\n $unwatch,\n $invalid\n };\n}\n\nfunction createValidatorResult(rule, model, $dirty, config, instance, validatorName, propertyKey, propertyPath, siblingState, $lastInvalidState, $lastCommittedOn) {\n const $pending = ref(false);\n const $params = rule.$params || {};\n const $response = ref(null);\n let $invalid;\n let $unwatch;\n\n if (rule.$async) {\n ({\n $invalid,\n $unwatch\n } = createAsyncResult(rule.$validator, model, $pending, $dirty, config, $response, instance, rule.$watchTargets, siblingState, $lastInvalidState, $lastCommittedOn));\n } else {\n ({\n $invalid,\n $unwatch\n } = createSyncResult(rule.$validator, model, $dirty, config, $response, instance, siblingState, $lastInvalidState));\n }\n\n const message = rule.$message;\n const $message = isFunction(message) ? computed(() => message(unwrapObj({\n $pending,\n $invalid,\n $params: unwrapObj($params),\n $model: model,\n $response,\n $validator: validatorName,\n $propertyPath: propertyPath,\n $property: propertyKey\n }))) : message || '';\n return {\n $message,\n $params,\n $pending,\n $invalid,\n $response,\n $unwatch\n };\n}\n\nfunction sortValidations() {\n let validationsRaw = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n const validations = unref(validationsRaw);\n const validationKeys = Object.keys(validations);\n const rules = {};\n const nestedValidators = {};\n const config = {};\n let validationGroups = null;\n validationKeys.forEach(key => {\n const v = validations[key];\n\n switch (true) {\n case isFunction(v.$validator):\n rules[key] = v;\n break;\n\n case isFunction(v):\n rules[key] = {\n $validator: v\n };\n break;\n\n case key === '$validationGroups':\n validationGroups = v;\n break;\n\n case key.startsWith('$'):\n config[key] = v;\n break;\n\n default:\n nestedValidators[key] = v;\n }\n });\n return {\n rules,\n nestedValidators,\n config,\n validationGroups\n };\n}\n\nconst ROOT_PATH = '__root';\n\nfunction createValidationResults(rules, model, key, resultsCache, path, config, instance, externalResults, siblingState) {\n const ruleKeys = Object.keys(rules);\n const cachedResult = resultsCache.get(path, rules);\n const $dirty = ref(false);\n const $lastInvalidState = ref(false);\n const $lastCommittedOn = ref(0);\n\n if (cachedResult) {\n if (!cachedResult.$partial) return cachedResult;\n cachedResult.$unwatch();\n $dirty.value = cachedResult.$dirty.value;\n }\n\n const result = {\n $dirty,\n $path: path,\n $touch: () => {\n if (!$dirty.value) $dirty.value = true;\n },\n $reset: () => {\n if ($dirty.value) $dirty.value = false;\n },\n $commit: () => {}\n };\n\n if (!ruleKeys.length) {\n cachedResult && resultsCache.set(path, rules, result);\n return result;\n }\n\n ruleKeys.forEach(ruleKey => {\n result[ruleKey] = createValidatorResult(rules[ruleKey], model, result.$dirty, config, instance, ruleKey, key, path, siblingState, $lastInvalidState, $lastCommittedOn);\n });\n result.$externalResults = computed(() => {\n if (!externalResults.value) return [];\n return [].concat(externalResults.value).map((stringError, index) => ({\n $propertyPath: path,\n $property: key,\n $validator: '$externalResults',\n $uid: `${path}-externalResult-${index}`,\n $message: stringError,\n $params: {},\n $response: null,\n $pending: false\n }));\n });\n result.$invalid = computed(() => {\n const r = ruleKeys.some(ruleKey => unref(result[ruleKey].$invalid));\n $lastInvalidState.value = r;\n return !!result.$externalResults.value.length || r;\n });\n result.$pending = computed(() => ruleKeys.some(ruleKey => unref(result[ruleKey].$pending)));\n result.$error = computed(() => result.$dirty.value ? result.$pending.value || result.$invalid.value : false);\n result.$silentErrors = computed(() => ruleKeys.filter(ruleKey => unref(result[ruleKey].$invalid)).map(ruleKey => {\n const res = result[ruleKey];\n return reactive({\n $propertyPath: path,\n $property: key,\n $validator: ruleKey,\n $uid: `${path}-${ruleKey}`,\n $message: res.$message,\n $params: res.$params,\n $response: res.$response,\n $pending: res.$pending\n });\n }).concat(result.$externalResults.value));\n result.$errors = computed(() => result.$dirty.value ? result.$silentErrors.value : []);\n\n result.$unwatch = () => ruleKeys.forEach(ruleKey => {\n result[ruleKey].$unwatch();\n });\n\n result.$commit = () => {\n $lastInvalidState.value = true;\n $lastCommittedOn.value = Date.now();\n };\n\n resultsCache.set(path, rules, result);\n return result;\n}\n\nfunction collectNestedValidationResults(validations, nestedState, path, resultsCache, config, instance, nestedExternalResults) {\n const nestedValidationKeys = Object.keys(validations);\n if (!nestedValidationKeys.length) return {};\n return nestedValidationKeys.reduce((results, nestedKey) => {\n results[nestedKey] = setValidations({\n validations: validations[nestedKey],\n state: nestedState,\n key: nestedKey,\n parentKey: path,\n resultsCache,\n globalConfig: config,\n instance,\n externalResults: nestedExternalResults\n });\n return results;\n }, {});\n}\n\nfunction createMetaFields(results, nestedResults, childResults) {\n const allResults = computed(() => [nestedResults, childResults].filter(res => res).reduce((allRes, res) => {\n return allRes.concat(Object.values(unref(res)));\n }, []));\n const $dirty = computed({\n get() {\n return results.$dirty.value || (allResults.value.length ? allResults.value.every(r => r.$dirty) : false);\n },\n\n set(v) {\n results.$dirty.value = v;\n }\n\n });\n const $silentErrors = computed(() => {\n const modelErrors = unref(results.$silentErrors) || [];\n const nestedErrors = allResults.value.filter(result => (unref(result).$silentErrors || []).length).reduce((errors, result) => {\n return errors.concat(...result.$silentErrors);\n }, []);\n return modelErrors.concat(nestedErrors);\n });\n const $errors = computed(() => {\n const modelErrors = unref(results.$errors) || [];\n const nestedErrors = allResults.value.filter(result => (unref(result).$errors || []).length).reduce((errors, result) => {\n return errors.concat(...result.$errors);\n }, []);\n return modelErrors.concat(nestedErrors);\n });\n const $invalid = computed(() => allResults.value.some(r => r.$invalid) || unref(results.$invalid) || false);\n const $pending = computed(() => allResults.value.some(r => unref(r.$pending)) || unref(results.$pending) || false);\n const $anyDirty = computed(() => allResults.value.some(r => r.$dirty) || allResults.value.some(r => r.$anyDirty) || $dirty.value);\n const $error = computed(() => $dirty.value ? $pending.value || $invalid.value : false);\n\n const $touch = () => {\n results.$touch();\n allResults.value.forEach(result => {\n result.$touch();\n });\n };\n\n const $commit = () => {\n results.$commit();\n allResults.value.forEach(result => {\n result.$commit();\n });\n };\n\n const $reset = () => {\n results.$reset();\n allResults.value.forEach(result => {\n result.$reset();\n });\n };\n\n if (allResults.value.length && allResults.value.every(nr => nr.$dirty)) $touch();\n return {\n $dirty,\n $errors,\n $invalid,\n $anyDirty,\n $error,\n $pending,\n $touch,\n $reset,\n $silentErrors,\n $commit\n };\n}\n\nfunction setValidations(_ref) {\n let {\n validations,\n state,\n key,\n parentKey,\n childResults,\n resultsCache,\n globalConfig = {},\n instance,\n externalResults\n } = _ref;\n const path = parentKey ? `${parentKey}.${key}` : key;\n const {\n rules,\n nestedValidators,\n config,\n validationGroups\n } = sortValidations(validations);\n\n const mergedConfig = _objectSpread2(_objectSpread2({}, globalConfig), config);\n\n const nestedState = key ? computed(() => {\n const s = unref(state);\n return s ? unref(s[key]) : undefined;\n }) : state;\n\n const cachedExternalResults = _objectSpread2({}, unref(externalResults) || {});\n\n const nestedExternalResults = computed(() => {\n const results = unref(externalResults);\n if (!key) return results;\n return results ? unref(results[key]) : undefined;\n });\n const results = createValidationResults(rules, nestedState, key, resultsCache, path, mergedConfig, instance, nestedExternalResults, state);\n const nestedResults = collectNestedValidationResults(nestedValidators, nestedState, path, resultsCache, mergedConfig, instance, nestedExternalResults);\n const $validationGroups = {};\n\n if (validationGroups) {\n Object.entries(validationGroups).forEach(_ref2 => {\n let [key, group] = _ref2;\n $validationGroups[key] = {\n $invalid: gatherBooleanGroupProperties(group, nestedResults, '$invalid'),\n $error: gatherBooleanGroupProperties(group, nestedResults, '$error'),\n $pending: gatherBooleanGroupProperties(group, nestedResults, '$pending'),\n $errors: gatherArrayGroupProperties(group, nestedResults, '$errors'),\n $silentErrors: gatherArrayGroupProperties(group, nestedResults, '$silentErrors')\n };\n });\n }\n\n const {\n $dirty,\n $errors,\n $invalid,\n $anyDirty,\n $error,\n $pending,\n $touch,\n $reset,\n $silentErrors,\n $commit\n } = createMetaFields(results, nestedResults, childResults);\n const $model = key ? computed({\n get: () => unref(nestedState),\n set: val => {\n $dirty.value = true;\n const s = unref(state);\n const external = unref(externalResults);\n\n if (external) {\n external[key] = cachedExternalResults[key];\n }\n\n if (isRef(s[key])) {\n s[key].value = val;\n } else {\n s[key] = val;\n }\n }\n }) : null;\n\n if (key && mergedConfig.$autoDirty) {\n watch(nestedState, () => {\n if (!$dirty.value) $touch();\n const external = unref(externalResults);\n\n if (external) {\n external[key] = cachedExternalResults[key];\n }\n }, {\n flush: 'sync'\n });\n }\n\n async function $validate() {\n $touch();\n\n if (mergedConfig.$rewardEarly) {\n $commit();\n await nextTick();\n }\n\n await nextTick();\n return new Promise(resolve => {\n if (!$pending.value) return resolve(!$invalid.value);\n const unwatch = watch($pending, () => {\n resolve(!$invalid.value);\n unwatch();\n });\n });\n }\n\n function $getResultsForChild(key) {\n return (childResults.value || {})[key];\n }\n\n function $clearExternalResults() {\n if (isRef(externalResults)) {\n externalResults.value = cachedExternalResults;\n } else {\n if (Object.keys(cachedExternalResults).length === 0) {\n Object.keys(externalResults).forEach(k => {\n delete externalResults[k];\n });\n } else {\n Object.assign(externalResults, cachedExternalResults);\n }\n }\n }\n\n return reactive(_objectSpread2(_objectSpread2(_objectSpread2({}, results), {}, {\n $model,\n $dirty,\n $error,\n $errors,\n $invalid,\n $anyDirty,\n $pending,\n $touch,\n $reset,\n $path: path || ROOT_PATH,\n $silentErrors,\n $validate,\n $commit\n }, childResults && {\n $getResultsForChild,\n $clearExternalResults,\n $validationGroups\n }), nestedResults));\n}\n\nclass ResultsStorage {\n constructor() {\n this.storage = new Map();\n }\n\n set(path, rules, result) {\n this.storage.set(path, {\n rules,\n result\n });\n }\n\n checkRulesValidity(path, rules, storedRules) {\n const storedRulesKeys = Object.keys(storedRules);\n const newRulesKeys = Object.keys(rules);\n if (newRulesKeys.length !== storedRulesKeys.length) return false;\n const hasAllValidators = newRulesKeys.every(ruleKey => storedRulesKeys.includes(ruleKey));\n if (!hasAllValidators) return false;\n return newRulesKeys.every(ruleKey => {\n if (!rules[ruleKey].$params) return true;\n return Object.keys(rules[ruleKey].$params).every(paramKey => {\n return unref(storedRules[ruleKey].$params[paramKey]) === unref(rules[ruleKey].$params[paramKey]);\n });\n });\n }\n\n get(path, rules) {\n const storedRuleResultPair = this.storage.get(path);\n if (!storedRuleResultPair) return undefined;\n const {\n rules: storedRules,\n result\n } = storedRuleResultPair;\n const isValidCache = this.checkRulesValidity(path, rules, storedRules);\n const $unwatch = result.$unwatch ? result.$unwatch : () => ({});\n if (!isValidCache) return {\n $dirty: result.$dirty,\n $partial: true,\n $unwatch\n };\n return result;\n }\n\n}\n\nconst CollectFlag = {\n COLLECT_ALL: true,\n COLLECT_NONE: false\n};\nconst VuelidateInjectChildResults = Symbol('vuelidate#injectChildResults');\nconst VuelidateRemoveChildResults = Symbol('vuelidate#removeChildResults');\nfunction nestedValidations(_ref) {\n let {\n $scope,\n instance\n } = _ref;\n const childResultsRaw = {};\n const childResultsKeys = ref([]);\n const childResults = computed(() => childResultsKeys.value.reduce((results, key) => {\n results[key] = unref(childResultsRaw[key]);\n return results;\n }, {}));\n\n function injectChildResultsIntoParent(results, _ref2) {\n let {\n $registerAs: key,\n $scope: childScope,\n $stopPropagation\n } = _ref2;\n if ($stopPropagation || $scope === CollectFlag.COLLECT_NONE || childScope === CollectFlag.COLLECT_NONE || $scope !== CollectFlag.COLLECT_ALL && $scope !== childScope) return;\n childResultsRaw[key] = results;\n childResultsKeys.value.push(key);\n }\n\n instance.__vuelidateInjectInstances = [].concat(instance.__vuelidateInjectInstances || [], injectChildResultsIntoParent);\n\n function removeChildResultsFromParent(key) {\n childResultsKeys.value = childResultsKeys.value.filter(childKey => childKey !== key);\n delete childResultsRaw[key];\n }\n\n instance.__vuelidateRemoveInstances = [].concat(instance.__vuelidateRemoveInstances || [], removeChildResultsFromParent);\n const sendValidationResultsToParent = inject(VuelidateInjectChildResults, []);\n provide(VuelidateInjectChildResults, instance.__vuelidateInjectInstances);\n const removeValidationResultsFromParent = inject(VuelidateRemoveChildResults, []);\n provide(VuelidateRemoveChildResults, instance.__vuelidateRemoveInstances);\n return {\n childResults,\n sendValidationResultsToParent,\n removeValidationResultsFromParent\n };\n}\n\nfunction ComputedProxyFactory(target) {\n return new Proxy(target, {\n get(target, prop) {\n return typeof target[prop] === 'object' ? ComputedProxyFactory(target[prop]) : computed(() => target[prop]);\n }\n\n });\n}\n\nlet uid = 0;\nfunction useVuelidate(validations, state) {\n var _getCurrentInstance;\n\n let globalConfig = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n if (arguments.length === 1) {\n globalConfig = validations;\n validations = undefined;\n state = undefined;\n }\n\n let {\n $registerAs,\n $scope = CollectFlag.COLLECT_ALL,\n $stopPropagation,\n $externalResults,\n currentVueInstance\n } = globalConfig;\n const instance = currentVueInstance || ((_getCurrentInstance = getCurrentInstance()) === null || _getCurrentInstance === void 0 ? void 0 : _getCurrentInstance.proxy);\n const componentOptions = instance ? instance.$options : {};\n\n if (!$registerAs) {\n uid += 1;\n $registerAs = `_vuelidate_${uid}`;\n }\n\n const validationResults = ref({});\n const resultsCache = new ResultsStorage();\n const {\n childResults,\n sendValidationResultsToParent,\n removeValidationResultsFromParent\n } = instance ? nestedValidations({\n $scope,\n instance\n }) : {\n childResults: ref({})\n };\n\n if (!validations && componentOptions.validations) {\n const rules = componentOptions.validations;\n state = ref({});\n onBeforeMount(() => {\n state.value = instance;\n watch(() => isFunction(rules) ? rules.call(state.value, new ComputedProxyFactory(state.value)) : rules, validations => {\n validationResults.value = setValidations({\n validations,\n state,\n childResults,\n resultsCache,\n globalConfig,\n instance,\n externalResults: $externalResults || instance.vuelidateExternalResults\n });\n }, {\n immediate: true\n });\n });\n globalConfig = componentOptions.validationsConfig || globalConfig;\n } else {\n const validationsWatchTarget = isRef(validations) || isProxy(validations) ? validations : reactive(validations || {});\n watch(validationsWatchTarget, newValidationRules => {\n validationResults.value = setValidations({\n validations: newValidationRules,\n state,\n childResults,\n resultsCache,\n globalConfig,\n instance: instance !== null && instance !== void 0 ? instance : {},\n externalResults: $externalResults\n });\n }, {\n immediate: true\n });\n }\n\n if (instance) {\n sendValidationResultsToParent.forEach(f => f(validationResults, {\n $registerAs,\n $scope,\n $stopPropagation\n }));\n onBeforeUnmount(() => removeValidationResultsFromParent.forEach(f => f($registerAs)));\n }\n\n return computed(() => {\n return _objectSpread2(_objectSpread2({}, unref(validationResults.value)), childResults.value);\n });\n}\n\nexport { CollectFlag, useVuelidate as default, useVuelidate };\n","\r\n\r\n\r\n\r\n\r\n","import LOCALIZATION from \"@core/classes/Localization\"\r\nimport ENUMS from \"@core/classes/Enums\"\r\nimport util from \"@core/services/util\";\r\nimport moment from 'moment'\r\nimport * as defaultValidators from '@vuelidate/validators'\r\nimport * as customValidators from '@core/services/custom-validators'\r\nimport * as applicationSettingsAPIs from '@core/classes/Applications/ApplicationsSettingsAPIs'\r\nimport * as applicationSettingsDropdowns from '@core/classes/Applications/ApplicationsSettingsDropdowns'\r\nimport $modal from '@core/services/modal'\r\nimport modalEditApplication from '@core/modals/customerApp/modalEditApplication.vue'\r\nimport CustomerApplicationHelper from '@core/helpers/customer-application-helper'\r\nimport ApplicationsSettingsLoader from '@core/classes/Applications/ApplicationsSettingsLoader'\r\nimport 'moment/locale/es'\r\nimport { reactive } from 'vue'\r\nimport { EventBusCore } from \"@core/services/util\";\r\n\r\nexport default class ApplicationsQuestion {\r\n constructor(init) {\r\n this.customerApp = () => init.customerApp\r\n this.key = init.question.key\r\n this.dateType = init.question.dateType\r\n this.mask = init.question.mask\r\n this.type = init.question.type\r\n this.triggerSave = init.question.triggerSave\r\n this.category = init.question.category\r\n this.dataStructurePath = init.question.dataStructurePath\r\n this.answerButtons = init.question.answerButtons\r\n this.summaryDisplay = init.question.summaryDisplay\r\n this.isEndOfApp = !!init.question.isEndOfApp\r\n this.isCompleted = !!init.question.isCompleted\r\n this.savedAnswer = init.question.savedAnswer\r\n this.cssClass = init.question.cssClass\r\n this.dropdown = init.question.dropdown\r\n this.textsToShow = init.question.textsToShow\r\n this.notesToShow = init.question.notesToShow\r\n this.prevQuestion = init.question.prevQuestion\r\n this.inputType = init.question.inputType\r\n this.onKeyPressMethod = init.question.onKeyPressMethod\r\n this.atInputMethod = init.question.atInputMethod\r\n this.minLength = null\r\n this.maxLength = null\r\n this.GetValidation = () => this.getValidators(init.question)\r\n this.redirectToPlaid = init.question.redirectToPlaid\r\n this.redirectToCustomerPortal = init.question.redirectToCustomerPortal\r\n this.isFirstInGroup = init.question.isFirstInGroup\r\n }\r\n\r\n ApplicationsSettings() {\r\n return ApplicationsSettingsLoader.ApplicationSettings;\r\n }\r\n\r\n getOnKeyPressMethod() {\r\n let methods = []\r\n if (this.onKeyPressMethod != null && this.onKeyPressMethod.length > 0) {\r\n methods = this.onKeyPressMethod?.filter(k => k.conditionToUse == null || this.checkConditions(k.conditionToUse))\r\n }\r\n\r\n if (methods.length > 0) {\r\n return methods[0].methodName\r\n }\r\n }\r\n\r\n getAtInputMethod() {\r\n let methods = []\r\n if (this.atInputMethod != null && this.atInputMethod.length > 0) {\r\n methods = this.atInputMethod?.filter(k => k.conditionToUse == null || this.checkConditions(k.conditionToUse))\r\n }\r\n\r\n if (methods.length > 0) {\r\n return methods[0].methodName\r\n }\r\n }\r\n\r\n getValidators(question) {\r\n let validation = []\r\n if (question.validation) {\r\n validation = question.validation.filter(v => v.conditionToUse == null || this.checkConditions(v.conditionToUse))\r\n this.minLength = validation?.find(v => v.propertyName == 'textValue')?.validators.find(vs => vs.type == 'minLength')?.params[0]\r\n this.maxLength = validation?.find(v => v.propertyName == 'textValue')?.validators.find(vs => vs.type == 'maxLength')?.params[0]\r\n }\r\n return util.getValidators([{ validation }])\r\n }\r\n\r\n isValidationsMet(answer, validation) {\r\n if (!answer.isValidationRequired || (answer.isValidationRequired && !validation)) {\r\n return true;\r\n }\r\n\r\n return !validation.$invalid;\r\n }\r\n\r\n saveAnswerFunc(value) {\r\n\r\n //updates the real model with the answer\r\n this.setValue(value)\r\n\r\n //for every question, we store any answer given in this.savedAnswer even if you go back to the previous question\r\n this.savedAnswer = value\r\n }\r\n\r\n saveMultiAnswerFunc(extraValue, saveExtraValuesTo) {\r\n this.setValue(extraValue, saveExtraValuesTo)\r\n }\r\n\r\n isDate() {\r\n return this.dateType != null\r\n }\r\n showDay() {\r\n return this.dateType == 'day'\r\n }\r\n showMonth() {\r\n return this.dateType == 'month' || this.dateType == 'day'\r\n }\r\n\r\n //creates the actions that will happen when you answer this question\r\n getAnswers() {\r\n let allAnswers = reactive([]);\r\n this.answerButtons.forEach(ab => {\r\n let labelToUse = ab.label ?? this.getValue(ab.labelPath)\r\n allAnswers.push({\r\n label: labelToUse,\r\n style: ab.style,\r\n isValidationRequired: ab.isValidationRequired,\r\n actions: async (value = true, extraSaves, question, toggleLoading, saveApplicationAction) => {\r\n const saveActionIndex = ab.actions.findIndex(a => a.action === ENUMS.CREDIT_APP_BUTTONS_ACTIONS.SAVE_ANSWER)\r\n if (saveActionIndex >= 0) {\r\n //pre save\r\n const preSaveActions = ab.actions.slice(0, saveActionIndex)\r\n await this.executeActions(preSaveActions, labelToUse, value, extraSaves, question, toggleLoading, saveApplicationAction)\r\n\r\n //save action\r\n const saveAction = ab.actions[saveActionIndex]\r\n let valueToSave = value;\r\n\r\n if (saveAction.overrides?.length > 0) {\r\n let override = saveAction.overrides.find(({ conditionList }) => conditionList == null || this.checkConditions(conditionList))\r\n\r\n if (override) {\r\n valueToSave = this.getOverrideValue(override)\r\n }\r\n }\r\n\r\n this.openModalEditApplication(valueToSave, question, async () => {\r\n //post save\r\n this.saveAnswerFunc(valueToSave)\r\n const postSaveActions = ab.actions.slice(saveActionIndex + 1)\r\n await this.executeActions(postSaveActions, labelToUse, value, extraSaves, question, toggleLoading, saveApplicationAction)\r\n })\r\n } else {\r\n await this.executeActions(ab.actions, labelToUse, value, extraSaves, question, toggleLoading, saveApplicationAction)\r\n }\r\n }\r\n })\r\n })\r\n\r\n return allAnswers;\r\n }\r\n\r\n async executeActions(actions, label, value, extraSaves, question, toggleLoading, saveApplicationAction) {\r\n const shouldToggleLoading = actions.some(x => {\r\n switch (x.action) {\r\n case ENUMS.CREDIT_APP_BUTTONS_ACTIONS.SAVE_FULL_APPLICATION:\r\n case ENUMS.CREDIT_APP_BUTTONS_ACTIONS.CALL_API:\r\n return true;\r\n default:\r\n return false;\r\n }\r\n });\r\n\r\n if (shouldToggleLoading) toggleLoading();\r\n\r\n for (const act of actions) {\r\n switch (act.action) {\r\n case ENUMS.CREDIT_APP_BUTTONS_ACTIONS.NEXT_QUESTION: {\r\n this.setNextQuestion(this.getNextQuestion(act, label), !(label == \"noSummary\")/*, act, saveApplicationAction*/)\r\n if (act.saveObj?.triggerSave && (act.saveObj.conditionsToSave == null || this.checkConditions(act.saveObj.conditionsToSave))) {\r\n await new Promise((resolve) => {\r\n setTimeout(async () => {\r\n await saveApplicationAction(true);\r\n resolve()\r\n }, 400)\r\n })\r\n }\r\n break;\r\n }\r\n case ENUMS.CREDIT_APP_BUTTONS_ACTIONS.SAVE_MULTI_ANSWER: {\r\n act.extraValuesToSave.forEach((e, index) => {\r\n if (e.type == \"value\" && e.override) {\r\n this.saveMultiAnswerFunc(this.getOverrideValue(e.override), e.savePath)\r\n //Structure to use in ApplicationSettings for this case (currently not being used)\r\n //extraValuesToSave: [\r\n // {\r\n // type: \"value\",\r\n // savePath: 'quoteAppData.applicationsDataAnswered.personalInfo.currentResidence.zipCode',\r\n // override: {\r\n // value: 'quoteAppData.applicationsDataAnswered.tempValue',\r\n // type: 'path'\r\n // }\r\n // },\r\n //],\r\n }\r\n else if (extraSaves.length != 0) {\r\n if (e.type == \"value\") {\r\n this.saveMultiAnswerFunc(extraSaves[index], e.savePath)\r\n }\r\n else {\r\n e.properties.forEach(p => this.saveMultiAnswerFunc(extraSaves[index][p.property], p.savePath))\r\n //Structure to use in ApplicationSettings for this case (currently not being used)\r\n //extraValuesToSave: [\r\n // {\r\n // type: \"object\",\r\n // properties: [\r\n // {\r\n // property: \"ssnHashed\",\r\n // savePath: 'quoteAppData.applicationsDataAnswered.personalInfo.ssnHashed'\r\n // },\r\n // ]\r\n // },\r\n //],\r\n }\r\n }\r\n })\r\n break;\r\n }\r\n case ENUMS.CREDIT_APP_BUTTONS_ACTIONS.CALL_API: {\r\n //timeout can be used to compensate for the animation time (0.3s) and some extras\r\n await new Promise((resolve) => {\r\n setTimeout(async () => {\r\n await applicationSettingsAPIs[act.apiMethod](value, extraSaves, question, this.customerApp());\r\n resolve()\r\n }, 400)\r\n })\r\n break;\r\n }\r\n case ENUMS.CREDIT_APP_BUTTONS_ACTIONS.SAVE_FULL_APPLICATION: {\r\n if (act.conditionsToSave == null || this.checkConditions(act.conditionsToSave)) {\r\n await new Promise((resolve) => {\r\n setTimeout(async () => {\r\n await saveApplicationAction(true);\r\n resolve()\r\n }, 400)\r\n\r\n })\r\n }\r\n break;\r\n }\r\n default:\r\n }\r\n }\r\n\r\n if (shouldToggleLoading) {\r\n setTimeout(async () => {\r\n toggleLoading();\r\n }, 400)\r\n }\r\n }\r\n\r\n openModalEditApplication(newValue, question, postFunction) {\r\n let { key, savedAnswer } = question\r\n let application = this.customerApp()\r\n\r\n //if date, update format for comparison\r\n if (this.isDate()) {\r\n savedAnswer = moment(savedAnswer, [\"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\", \"YYYY-MM-DDTHH:mm:ss[Z]\"]).format(\"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\")\r\n }\r\n\r\n //if completed, the values are different, and the old one was not null(different path), user needs to justify change\r\n if (application.isCompleted() && savedAnswer != null && `${newValue}` != `${savedAnswer}`) {\r\n $modal.open(modalEditApplication, {\r\n name: \"modalEditApplication\",\r\n passedData: { key, savedAnswer, newValue, application },\r\n backdrop: true,\r\n postFunction\r\n });\r\n } else {\r\n postFunction()\r\n }\r\n }\r\n\r\n //for every question, we store any answer given in this.savedAnswer even if you go back to the previous question\r\n //this function recalls the last given answer for this question (that we stored)\r\n getSavedAnswer() {\r\n return this.savedAnswer\r\n }\r\n\r\n getNextQuestion(act, label) {\r\n let nextQuestion = act.nextQuestion\r\n\r\n if (this.customerApp().plaidId) {\r\n console.log(\"nextQuestion\", nextQuestion);\r\n let prefilledReplacement = this.ApplicationsSettings().prefilledReplacements.find(r => r.useQuestionKey === nextQuestion)\r\n if (prefilledReplacement) {\r\n console.log(\"prefilledReplacement\", prefilledReplacement);\r\n nextQuestion = prefilledReplacement.nextQuestionKey\r\n }\r\n }\r\n\r\n //If question is summary, it is removed from the path\r\n if (this.type.includes('Summary') && label == \"noSummary\") {\r\n let complete = false\r\n for (var i = this.customerApp().quoteAppData.pathFollowed.length - 1; i >= 0; i--) {\r\n if (!complete) {\r\n let questionDeleted = this.customerApp().quoteAppData.pathFollowed.pop()\r\n if (questionDeleted == act.nextQuestion) {\r\n complete = true\r\n }\r\n }\r\n }\r\n }\r\n else if (act.conditions?.length > 0) {\r\n let condition = act.conditions.find(({ conditionList }) => this.checkConditions(conditionList))\r\n\r\n if (condition) {\r\n nextQuestion = condition.goTo\r\n }\r\n }\r\n\r\n return nextQuestion;\r\n }\r\n\r\n checkConditions(conditionList) {\r\n return conditionList?.every(({ dataPath, dataPathType, comparisonType, value, valueType }) => {\r\n let savedValue = this.getValue(dataPath);\r\n let valueToCompare = (valueType == \"path\") ? this.getValue(value) : value;\r\n\r\n //Values Transformation for the edge DATE case\r\n if (dataPathType == 'date') {\r\n savedValue = moment().diff(moment(savedValue, \"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\"), 'months')\r\n valueToCompare = parseInt(valueToCompare)\r\n }\r\n\r\n if (dataPathType == \"array\") {\r\n if (comparisonType == 'equal') {\r\n return savedValue.some(s => this.compareValues(comparisonType, s, valueToCompare))\r\n }\r\n else {\r\n return savedValue.every(s => this.compareValues(comparisonType, s, valueToCompare))\r\n }\r\n } else {\r\n return this.compareValues(comparisonType, savedValue, valueToCompare)\r\n }\r\n })\r\n }\r\n\r\n compareValues(comparisonType, value, valueToCompare) {\r\n if (comparisonType == 'equal' && value == valueToCompare) {\r\n return true;\r\n }\r\n else if (comparisonType == 'greaterOrEqual' && value >= valueToCompare) {\r\n return true;\r\n }\r\n else if (comparisonType == 'lessOrEqual' && value <= valueToCompare) {\r\n return true;\r\n }\r\n else if (comparisonType == 'greater' && value > valueToCompare) {\r\n return true;\r\n }\r\n else if (comparisonType == 'less' && value < valueToCompare) {\r\n return true;\r\n }\r\n else if (comparisonType == 'different' && value != valueToCompare) {\r\n return true;\r\n }\r\n else {\r\n return false;\r\n }\r\n }\r\n\r\n /**\r\n * Takes the user to the next question in the quote application.\r\n * Triggers an event when changing the current question to the next.\r\n *\r\n * This method handles navigation to the next question and emits an event\r\n * to notify components about the question change.\r\n *\r\n * @param {*} nextQuestion The next question to navigate to.\r\n * @param {boolean} addToPathFollow Whether to add the current question to the path followed (default: true).\r\n *\r\n * @remarks\r\n * - currentQuestion: Represents the current question before navigating to the next one.\r\n * - nextQuestion: Represents the next question that the user navigates to.\r\n * - addToPathFollow: Indicates whether to add the current question to the path followed.\r\n */\r\n setNextQuestion(nextQuestion, addToPathFollow = true/*, act, saveApplicationAction*/) {\r\n const app = this.customerApp();\r\n const currentQuestion = app.quoteAppData.currentQuestion;\r\n\r\n // If the application is being edit in single question mode, the next question will be set to the edit thank you page\r\n if (app.isSingleQuestionEdit == true) {\r\n nextQuestion = 'applicationUpdated'\r\n }\r\n\r\n // Add the current question to the path followed if addToPathFollow is true\r\n if (addToPathFollow) {\r\n app.quoteAppData.pathFollowed.push(currentQuestion);\r\n }\r\n\r\n // Update the current question to the next question\r\n app.quoteAppData.currentQuestion = nextQuestion;\r\n\r\n //// Need the save here\r\n //if (act.saveObj?.triggerSave && (act.saveObj.conditionsToSave == null || this.checkConditions(act.saveObj.conditionsToSave))) {\r\n // await new Promise((resolve) => {\r\n // setTimeout(async () => {\r\n // await saveApplicationAction(true);\r\n // resolve()\r\n // }, 400)\r\n // })\r\n //}\r\n\r\n // Emit an event indicating the navigation to the next question\r\n EventBusCore.emit(\"goToNextQuestion\", currentQuestion, nextQuestion); //FIXME: Don't manipulate components from non-plugins\r\n }\r\n\r\n /**\r\n * Takes the user to the previous question in the quote application.\r\n * Triggers an event when changing the current question to the previous.\r\n *\r\n * This method handles navigation to the previous question and emits an event\r\n * to notify components about the question change.\r\n *\r\n * @remarks\r\n * - currentQuestion: Represents the current question before navigating to the previous one.\r\n * - upcomingQuestion: Represents the previous question that the user navigates back to,\r\n * retrieved from the path followed.\r\n */\r\n getPreviousQuestion() {\r\n const app = this.customerApp();\r\n const currentQuestion = app.quoteAppData.currentQuestion;\r\n\r\n // Check if there's a previous question available in the path followed\r\n if (app.quoteAppData.pathFollowed.length > 0) {\r\n // Pop the last question from the path followed as the upcoming question\r\n const upcomingQuestion = app.quoteAppData.pathFollowed.pop();\r\n\r\n // Reset any necessary state or values (not specified in the original code)\r\n this.setValue(null);\r\n\r\n // Set the current question to the upcoming question (previous question)\r\n app.quoteAppData.currentQuestion = upcomingQuestion;\r\n\r\n // Emit an event indicating the navigation to the previous question\r\n EventBusCore.emit(\"goToPreviousQuestion\", currentQuestion, upcomingQuestion); //FIXME: Don't manipulate components from non-plugins\r\n }\r\n }\r\n\r\n //returns the text for this question\r\n //substitutes place holders ({dataPath}) with answers based on THAT question's answer\r\n //ex: \"Hello, {firstNameQuestionKey}\" => Hello, Simcha\r\n\r\n doesQuestionHasValue(text) {\r\n let questionValue = this.getValue(this.customerApp().quoteAppData.questions.find(q => q.key == text.conditionToShow).dataStructurePath)\r\n return questionValue && (!Array.isArray(questionValue) || (Array.isArray(questionValue) && questionValue.length > 0))\r\n }\r\n\r\n getQuestion() {\r\n let output = []\r\n this.textsToShow.filter(t => t.conditionToShow == null || this.checkConditions(t.conditionToShow)).forEach(text => {\r\n let question = text[this.customerApp().quoteAppData.language]\r\n\r\n question = CustomerApplicationHelper.getPrefilledData(this.ApplicationsSettings().prefilledReplacements, this.customerApp().preFilledData, question, this.customerApp().quoteAppData.language)\r\n\r\n this.customerApp().quoteAppData.questions.forEach(q => {\r\n let formattedKey = '{' + q.key + '}';\r\n while (question.includes(formattedKey)) {\r\n if (this.getValue(q.dataStructurePath) == null) {\r\n question = question.replace(formattedKey, '')\r\n } else {\r\n question = question.replace(formattedKey, q.getFormatToDisplay(q.getValue(q.dataStructurePath), this.customerApp().quoteAppData.language))\r\n }\r\n }\r\n });\r\n output.push(question)\r\n })\r\n\r\n return output\r\n }\r\n\r\n getNotes() {\r\n let output = []\r\n\r\n this.notesToShow?.filter(t => t.conditionToShow == null || this.checkConditions(t.conditionToShow)).forEach(text => {\r\n let notes = text[this.customerApp().quoteAppData.language]\r\n notes = CustomerApplicationHelper.getPrefilledData(this.ApplicationsSettings().prefilledReplacements, this.customerApp().preFilledData, notes, this.customerApp().quoteAppData.language)\r\n\r\n this.customerApp().quoteAppData.questions.forEach(q => {\r\n let formattedKey = '{' + q.key + '}';\r\n while (notes.includes(formattedKey)) {\r\n if (this.getValue(q.dataStructurePath) == null) {\r\n notes = notes.replace(formattedKey, '')\r\n } else {\r\n notes = notes.replace(formattedKey, q.getFormatToDisplay(q.getValue(q.dataStructurePath), this.customerApp().quoteAppData.language))\r\n }\r\n }\r\n });\r\n output.push(notes)\r\n })\r\n\r\n return output\r\n }\r\n\r\n getFormatToDisplay(formatToDisplay, language) {\r\n if (this.type == 'QuestionDate') {\r\n switch (this.dateType) {\r\n case \"year\":\r\n formatToDisplay = moment(formatToDisplay, [\"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\"]).locale('es').format('YYYY')\r\n break;\r\n case \"month\":\r\n if (language == \"Spanish\") {\r\n if (moment(formatToDisplay, [\"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\"]).year() >= 2000) {\r\n formatToDisplay = moment(formatToDisplay, [\"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\"]).locale('es').format('MMMM [del] YYYY')\r\n } else {\r\n formatToDisplay = moment(formatToDisplay, [\"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\"]).locale('es').format('MMMM [de] YYYY')\r\n }\r\n }\r\n else {\r\n formatToDisplay = moment(formatToDisplay, [\"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\"]).locale('en').format('MMMM, YYYY')\r\n }\r\n break;\r\n default:\r\n if (language == \"Spanish\") {\r\n if (moment(formatToDisplay, [\"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\"]).year() >= 2000) {\r\n formatToDisplay = moment(formatToDisplay, [\"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\"]).locale('es').format('D [de] MMMM [del] YYYY')\r\n } else {\r\n formatToDisplay = moment(formatToDisplay, [\"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\"]).locale('es').format('D [de] MMMM [de] YYYY')\r\n }\r\n }\r\n else {\r\n formatToDisplay = moment(formatToDisplay, [\"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\"]).locale('en').format('MMMM Do, YYYY')\r\n }\r\n break;\r\n }\r\n\r\n } else if (this.type == 'QuestionInputDropdown') {\r\n formatToDisplay = this.getDropdownsDisplay(formatToDisplay, language);\r\n } else if (this.type == 'QuestionMultiButtons') {\r\n formatToDisplay = this.getLocalizationDisplay(formatToDisplay, language)\r\n } else if (this.type == 'QuestionInputPhone') {\r\n formatToDisplay = this.formatPhone(formatToDisplay)\r\n } else if (this.type == 'QuestionSocial') {\r\n formatToDisplay = this.formatSocial(formatToDisplay)\r\n } else if (this.type == 'QuestionInputCurrency') {\r\n formatToDisplay = this.formatCurrency(formatToDisplay)\r\n } else if (this.type == 'QuestionMultiSelect') {\r\n let joinText = null\r\n if (this.key == 'rebateOrganizations') {\r\n joinText = language == \"English\" ? ' and ' : ' y '\r\n } else {\r\n joinText = language == \"English\" ? ' or ' : ' o '\r\n }\r\n formatToDisplay = formatToDisplay.map(item => this.getLocalizationDisplay(item, language)).join(joinText);\r\n }\r\n\r\n return formatToDisplay\r\n }\r\n\r\n getDropdownsDisplay(formatToDisplay, language) {\r\n if (!this.dropdown.displayValue) {\r\n let dropdown = applicationSettingsDropdowns[this.dropdown.listMethod](this.dropdown.keys, language, this.customerApp, () => { });\r\n let answer = dropdown.find(d => d.value == formatToDisplay)?.text\r\n if (answer) {\r\n formatToDisplay = answer\r\n }\r\n }\r\n return formatToDisplay\r\n }\r\n\r\n clearAnswer() {\r\n this.savedAnswer = null;\r\n }\r\n\r\n getLocalizationDisplay(formatToDisplay, language) {\r\n let localizationDisplay = formatToDisplay\r\n if (LOCALIZATION.buttonLabels[formatToDisplay]) {\r\n localizationDisplay = LOCALIZATION.buttonLabels[formatToDisplay][language]\r\n }\r\n\r\n return localizationDisplay\r\n }\r\n\r\n formatPhone(value) {\r\n let valueFormatted = '';\r\n for (let i = 0; i < value.length; i++) {\r\n if (i == 0) {\r\n valueFormatted += '+1 ('\r\n } else if (i == 3) {\r\n valueFormatted += ') '\r\n } else if (i == 6) {\r\n valueFormatted += '-'\r\n }\r\n valueFormatted += value[i]\r\n }\r\n return valueFormatted\r\n }\r\n formatSocial(value) {\r\n let valueFormatted = '';\r\n if (this.mask == 'XX-XXXXXXX') {\r\n for (let i = 0; i < value.length; i++) {\r\n if (i == 2) {\r\n valueFormatted += '-'\r\n }\r\n valueFormatted += value[i]\r\n }\r\n }\r\n else {\r\n for (let i = 0; i < value.length; i++) {\r\n if (i == 3) {\r\n valueFormatted += '-'\r\n } else if (i == 5) {\r\n valueFormatted += '-'\r\n }\r\n valueFormatted += value[i]\r\n }\r\n }\r\n\r\n return valueFormatted\r\n }\r\n formatCurrency(value) {\r\n let valueFormatted = '$' + value.toLocaleString()\r\n\r\n return valueFormatted\r\n }\r\n\r\n isQuestionInPath(questionKey) {\r\n return this.customerApp().quoteAppData.pathFollowed.includes(questionKey)\r\n }\r\n\r\n getOverrideValue(override) {\r\n switch (override.type) {\r\n case \"path\":\r\n return this.getValue(override.value)\r\n default:\r\n return override.value\r\n }\r\n }\r\n\r\n //find memory location for last key in save path, and set value to it\r\n //ex: (\"simcha\",\"this.customerApp().quoteAppData.customer.firstName\") => this.customerApp().quoteAppData.customer.firstName will be set to \"simcha\"\r\n setValue(value, path = null) {\r\n let object = this.customerApp()\r\n let pathArray = path ? path.split('.') : this.dataStructurePath.split('.');\r\n let lastKey = pathArray.pop();\r\n\r\n let updateKey = (property, isLastKey) => {\r\n if (property.includes('[')) {\r\n let propertyPieces = property.split('[')\r\n\r\n property = propertyPieces[0]\r\n object = object[property]\r\n property = propertyPieces.pop().split(']')[0]\r\n\r\n if (object[property] == null) {\r\n object.push({})\r\n }\r\n }\r\n\r\n if (isLastKey) {\r\n object[property] = value;\r\n } else {\r\n object = object[property]\r\n }\r\n }\r\n\r\n pathArray.forEach((p) => {\r\n updateKey(p)\r\n })\r\n\r\n updateKey(lastKey, true)\r\n }\r\n\r\n //get value based on string path\r\n //ex: \"this.customerApp().quoteAppData.customer.firstName\" will return \"simcha\"\r\n getValue(pathString) {\r\n let object = this.customerApp()\r\n\r\n let updateKey = (property) => {\r\n if (property.includes('[')) {\r\n let propertyPieces = property.split('[')\r\n\r\n property = propertyPieces[0]\r\n object = object[property]\r\n property = propertyPieces.pop().split(']')[0]\r\n }\r\n\r\n if (object == null) {\r\n return null\r\n }\r\n\r\n object = object[property]\r\n }\r\n\r\n pathString.split('.').forEach((p) => {\r\n updateKey(p)\r\n })\r\n\r\n return object\r\n }\r\n\r\n populateSavedAnswer() {\r\n const savedAnswer = this.getValue(this.dataStructurePath)\r\n if (savedAnswer) {\r\n this.savedAnswer = savedAnswer\r\n }\r\n }\r\n}\r\n","import ApplicationsDataAnswered from \"./ApplicationsDataAnswered\"\r\nimport ApplicationsQuestion from \"./ApplicationsQuestion\"\r\nimport ApplicationsSettingsLoader from '@core/classes/Applications/ApplicationsSettingsLoader'\r\n\r\nimport util from \"@core/services/util\"\r\n\r\nexport default class ApplicationsQuoteAppData {\r\n constructor(init) {\r\n let questionList = this.ApplicationsSettings()?.questionList ?? []\r\n\r\n if (init.quoteAppData) {\r\n this.questions = questionList.map(q => {\r\n if (init.quoteAppData.pathFollowed.some(pq => pq == q.key) || init.quoteAppData.currentQuestion == q.key) {\r\n q.savedAnswer = util.getPropValueRaw(init, q.dataStructurePath)\r\n }\r\n return new ApplicationsQuestion({ question: q, customerApp: init.customerApp })\r\n });\r\n this.pathFollowed = init.quoteAppData.pathFollowed; // List with the keys of all answered questions\r\n this.language = init.quoteAppData.language; // Possible Values: English, Spanish\r\n this.summary = init.quoteAppData.summary;\r\n this.currentQuestion = init.quoteAppData.currentQuestion;\r\n this.applicationsDataAnswered = new ApplicationsDataAnswered(init.quoteAppData.applicationsDataAnswered);\r\n } else {\r\n this.questions = questionList.map(q => new ApplicationsQuestion({ question: q, customerApp: init.customerApp }))\r\n this.pathFollowed = []\r\n this.language = 'English'\r\n this.summary = ''\r\n this.currentQuestion = \"providePrefix\"\r\n this.applicationsDataAnswered = new ApplicationsDataAnswered();\r\n }\r\n }\r\n\r\n getSanitizedData() {\r\n let sanitizedData = new ApplicationsQuoteAppData({ quoteAppData: this })\r\n sanitizedData.questions = null\r\n\r\n return sanitizedData\r\n }\r\n\r\n ApplicationsSettings() {\r\n return ApplicationsSettingsLoader.ApplicationSettings;\r\n }\r\n\r\n changeLanguage(language) {\r\n this.language = language;\r\n }\r\n\r\n}","\r\nexport default class ApplicationsSessionLog {\r\n constructor(init) {\r\n this.sessionTimestamp = null;\r\n this.ipv4Address = null;\r\n this.os = null;\r\n this.device = null;\r\n this.brand = null;\r\n this.model = null;\r\n this.agreedTerms = [];\r\n\r\n if (init) {\r\n this.sessionTimestamp = init.sessionTimestamp;\r\n this.ipv4Address = init.ipv4Address;\r\n this.os = init.os;\r\n this.device = init.device;\r\n this.brand = init.brand;\r\n this.model = init.model;\r\n this.agreedTerms = init.agreedTerms;\r\n }\r\n }\r\n\r\n}\r\n\r\n\r\n\r\n\r\n","import ApplicationsChangeLog from \"./ApplicationsChangeLog\";\r\nimport ApplicationsPreFilledData from \"./ApplicationsPreFilledData\";\r\nimport ApplicationsQuoteAppData from \"./ApplicationsQuoteAppData\";\r\nimport ApplicationsSessionLog from \"./ApplicationsSessionLog\";\r\nimport ENUMS from \"@core/classes/Enums\";\r\nimport moment from 'moment'\r\nimport util from \"@core/services/util\";\r\n\r\nexport default class Application {\r\n constructor(init) {\r\n if (init) {\r\n this.id = init.id\r\n this.emailCode = init.emailCode\r\n this.emailCodeExpiration = init.emailCodeExpiration ? moment(init.emailCodeExpiration, \"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\").format(\"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\") : init.emailCodeExpiration\r\n this.phoneCode = init.phoneCode\r\n this.phoneCodeExpiration = init.phoneCodeExpiration ? moment(init.phoneCodeExpiration, \"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\").format(\"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\") : init.phoneCodeExpiration\r\n this.editLinkExpiration = init.editLinkExpiration ? moment(init.editLinkExpiration, \"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\").format(\"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\") : init.editLinkExpiration\r\n this.isSingleQuestionEdit = init.isSingleQuestionEdit //Only use this as a flag when calling the function that creates the CustomerPanelObject\r\n this.customerId = init.customerId\r\n this.leadId = init.leadId\r\n this.plaidId = init.plaidId\r\n this.guarantorApplicationId = init.guarantorApplicationId\r\n this.businessApplicationId = init.businessApplicationId\r\n this.status = init.status\r\n this.dateCreated = init.dateCreated ? moment(init.dateCreated, \"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\").format(\"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\") : init.dateCreated\r\n this.dateCompleted = init.dateCompleted ? moment(init.dateCompleted, \"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\").format(\"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\") : init.dateCompleted\r\n this.storeCode = init.storeCode\r\n this.preFilledData = new ApplicationsPreFilledData(init.preFilledData);\r\n this.quoteAppData = new ApplicationsQuoteAppData({ quoteAppData: init.quoteAppData, customerApp: this })\r\n this.changeLogs = []\r\n this.fiManagerGenerated = init.fiManagerGenerated\r\n this.canSave = init.canSave\r\n this.isEmailVerified = init.isEmailVerified\r\n this.isPhoneVerified = init.isPhoneVerified\r\n this.isLatestApplication = init.isLatestApplication\r\n this.createAppParams = init.createAppParams\r\n if (init.changeLogs) {\r\n init.changeLogs.forEach(cl => {\r\n this.changeLogs.push(new ApplicationsChangeLog(cl))\r\n })\r\n }\r\n this.sessionLogs = []\r\n if (init.sessionLogs) {\r\n init.sessionLogs.forEach(sl => {\r\n this.sessionLogs.push(new ApplicationsSessionLog(sl))\r\n })\r\n }\r\n }\r\n else {\r\n this.id = null\r\n this.emailCode = null\r\n this.emailCodeExpiration = null\r\n this.phoneCode = null\r\n this.phoneCodeExpiration = null\r\n this.editLinkExpiration = null\r\n this.isSingleQuestionEdit = null\r\n this.customerId = null\r\n this.leadId = null\r\n this.plaidId = null\r\n this.guarantorApplicationId = null\r\n this.businessApplicationId = null\r\n this.status = 0\r\n this.dateCreated = null\r\n this.dateCompleted = null\r\n this.storeCode = null\r\n this.preFilledData = new ApplicationsPreFilledData();\r\n this.quoteAppData = new ApplicationsQuoteAppData({ quoteAppData: null, customerApp: this })\r\n this.isEmailVerified = false\r\n this.isPhoneVerified = false\r\n this.changeLogs = []\r\n this.sessionLogs = []\r\n this.canSave = null;\r\n this.isLatestApplication = null;\r\n this.createAppParams = {}\r\n }\r\n }\r\n\r\n getSanitizedData() {\r\n let sanitizedData = new Application(this)\r\n sanitizedData.quoteAppData = sanitizedData.quoteAppData.getSanitizedData()\r\n\r\n return sanitizedData\r\n }\r\n\r\n isCompleted() {\r\n return this.dateCompleted != null\r\n }\r\n\r\n setSNNType(ssn) {\r\n let ssnGroupNumber = ssn.slice(3, 5)\r\n if (ssn.slice(0, 1) == 9 &&\r\n ((ssnGroupNumber >= 50 && ssnGroupNumber <= 65) ||\r\n (ssnGroupNumber >= 70 && ssnGroupNumber <= 88) ||\r\n (ssnGroupNumber >= 90 && ssnGroupNumber <= 92) ||\r\n (ssnGroupNumber >= 94 && ssnGroupNumber <= 99))) {\r\n this.quoteAppData.applicationsDataAnswered.personalInfo.ssnType = ENUMS.SSN_TYPES.ITIN\r\n }\r\n else {\r\n this.quoteAppData.applicationsDataAnswered.personalInfo.ssnType = ENUMS.SSN_TYPES.SSN\r\n }\r\n }\r\n\r\n isBusinessWithApplicantAsGuarantor() {\r\n if (this.quoteAppData.applicationsDataAnswered.isBusiness && this.quoteAppData.applicationsDataAnswered.businessInfo.hasGuarantor && this.quoteAppData.applicationsDataAnswered.businessInfo.isApplicantGuarantor) {\r\n return true\r\n }\r\n return false\r\n }\r\n\r\n hasAgreedTerms() {\r\n return !!this.sessionLogs?.some(sl => sl?.agreedTerms);\r\n }\r\n\r\n update(application) {\r\n try {\r\n util.deepUpdate(this, application)\r\n } catch (error) {\r\n console.error(\"Error updating:\", error);\r\n }\r\n }\r\n}","import 'moment/locale/es'\r\nimport api from '@core/services/api'\r\nimport Application from '@core/classes/Applications/Application';\r\nimport { CUSTOMER_APPLICATION_STATUS } from '@core/classes/Enums'\r\nimport FIMenuCustomer from '@core/classes/FIMenuCustomer';\r\nimport { IStore } from './Customer/customer-helper';\r\nimport moment from 'moment'\r\nimport settings from 'settings';\r\nimport util from '@core/services/util';\r\nmoment.locale('en');\r\n\r\n export async function getCustomerApplication(customerId: string) {\r\n try {\r\n const customerAppData = await api.applications.getByCustomer(customerId)\r\n if (customerAppData?.status == 200 && customerAppData.data) {\r\n const customerApplication = new Application(customerAppData.data);\r\n return customerApplication;\r\n }\r\n } catch (error) {\r\n console.error('error', error)\r\n }\r\n }\r\n\r\n export const getPrefilledData: any = (dataToReplace: any, sourceData: any, question: any, language: any) => {\r\n dataToReplace.forEach((r: any) => {\r\n const formattedKey: any = '{' + r.key + '}';\r\n while (question.includes(formattedKey)) {\r\n const propertyValue: any = sourceData[r.prefilledPropertyName]\r\n if (propertyValue == null) {\r\n question = question.replace(formattedKey, '')\r\n } else {\r\n if (r.type == 'date') {\r\n let textWithReplacements = propertyValue\r\n if (language == \"Spanish\") {\r\n if (moment(textWithReplacements, \"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\").year() >= 2000) {\r\n if (question.dateType == \"year\") {\r\n textWithReplacements = moment(textWithReplacements, \"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\").locale('es').format('YYYY')\r\n }\r\n textWithReplacements = moment(textWithReplacements, \"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\").locale('es').format('D [de] MMMM [del] YYYY')\r\n } else {\r\n textWithReplacements = moment(textWithReplacements, \"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\").locale('es').format('D [de] MMMM [de] YYYY')\r\n }\r\n } else {\r\n textWithReplacements = moment(textWithReplacements, \"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\").locale('en').format('MMMM Do, YYYY')\r\n }\r\n question = question.replace(formattedKey, textWithReplacements)\r\n } else {\r\n question = question.replace(formattedKey, propertyValue)\r\n }\r\n }\r\n }\r\n });\r\n return question\r\n }\r\n\r\n export function hasCustomerApplication(customer: FIMenuCustomer = null, customerApp: Application = null) {\r\n if(customer != null) {\r\n return !!customer?.customerApplication?.id\r\n } else if(customerApp != null) {\r\n return !!customerApp?.id;\r\n }\r\n }\r\n\r\n export function hasCustomerApplicationBeenStarted(customer: FIMenuCustomer = null, customerApp: Application = null) {\r\n if(customer != null) {\r\n return !!customer?.customerApplication?.id\r\n } else if(customerApp != null) {\r\n return !!customerApp?.id && customerApp?.status > CUSTOMER_APPLICATION_STATUS.Created;\r\n }\r\n }\r\n\r\n export const isCustomerApplicationPartiallyCompleted = (customerApp: Application) => {\r\n if(customerApp != null) {\r\n if (customerApp.status == CUSTOMER_APPLICATION_STATUS.PartiallyCompleted) {\r\n return true;\r\n }\r\n else return false;\r\n }\r\n };\r\n\r\n export function isCustomerApplicationComplete(customer: FIMenuCustomer = null, customerApp: Application = null) {\r\n if(customer != null) {\r\n return customer?.customerApplication?.status == CUSTOMER_APPLICATION_STATUS.Completed || customer?.customerApplication?.status == CUSTOMER_APPLICATION_STATUS.CompletedNoCredit;\r\n } else if(customerApp != null) {\r\n return customerApp?.status == CUSTOMER_APPLICATION_STATUS.Completed || customerApp?.status == CUSTOMER_APPLICATION_STATUS.CompletedNoCredit;\r\n }\r\n }\r\n\r\n export function isCreditApplicationComplete(customer: FIMenuCustomer = null, customerApp: Application = null) {\r\n if(customer != null) {\r\n return customer?.customerApplication.status == CUSTOMER_APPLICATION_STATUS.Completed;\r\n } else if(customerApp != null) {\r\n return customerApp?.status == CUSTOMER_APPLICATION_STATUS.Completed;\r\n } else return false;\r\n }\r\n\r\n export function isEditApplicationPastDayLimit(customerApp: Application) {\r\n if (!customerApp?.dateCompleted) return false;\r\n\r\n const daysCount = moment().utc().diff(customerApp.dateCompleted, 'days')\r\n return daysCount >= 160 // If its past 6 months\r\n }\r\n\r\n export const isEditApplicationPastDayLimitByGlobalSettingsCheck = (customerApp: Application) => {\r\n if (!customerApp?.dateCompleted) return false;\r\n\r\n const daysCount = moment().diff(customerApp.dateCompleted, 'days')\r\n const currentExpirationDateFromSettings = settings.lookups.customerApplicationEditPeriod\r\n return daysCount >= currentExpirationDateFromSettings ? true : false\r\n }\r\n\r\n export const isCustomerApplicationExpiredByGlobalSettingsCheck = (dateCompleted: any) => {\r\n if (dateCompleted) {\r\n const daysCount = moment().diff(dateCompleted, 'days')\r\n const currentExpirationDateFromSettings = settings.lookups.customerApplicationExpiration\r\n return daysCount >= currentExpirationDateFromSettings ? true : false\r\n } else return false;\r\n }\r\n\r\n export const isCustomerApplicationExpired = async (customerApp: Application) => {\r\n try {\r\n const response = await api.applications.checkIfApplicationIsExpired(customerApp);\r\n return !!response?.data;\r\n } catch (error) {\r\n util.toastr(\"error\", \"Error\", \"Please try again\")\r\n console.error(error)\r\n }\r\n }\r\n\r\n export const checkIfWeNeedANewApplication = async (customer: any, store: IStore, storeCode: string = null) => {\r\n if (!customer.customerApplication || isCustomerApplicationExpiredByGlobalSettingsCheck(customer.customerApplication.dateCompleted)) {\r\n try {\r\n const currentStoreCode = store?.storeCode ?? storeCode ?? null;\r\n if(currentStoreCode == null) return null;\r\n\r\n const customerApp = await createCustomerApplicationFromCustomer(null, customer, false, currentStoreCode);\r\n customer.customerApplication = customerApp;\r\n if (customerApp != null) {\r\n util.toastr(\"success\", \"Success\", \"Successfully sent.\");\r\n return customerApp;\r\n }\r\n } catch (error) {\r\n util.toastr(\"error\", \"Error\", \"Error sending link to customer. Try again.\");\r\n }\r\n }\r\n }\r\n\r\n export async function createCustomerApplicationFromCustomer(customerApp: Application, customer: any, isInCustomerPortal: boolean = false, storeCode: string = null ) {\r\n if (!customerApp || isCustomerApplicationExpiredByGlobalSettingsCheck(customerApp.dateCompleted)) {\r\n try {\r\n const response = await api.applications.createApplication({\r\n prefilledData: {\r\n language: customer.language ?? \"English\",\r\n firstName: customer.firstName,\r\n lastName: customer.lastName,\r\n dateOfBirth: customer.dob,\r\n phoneNumber:customer.cell,\r\n emailAddress: customer.email,\r\n isBusiness: false,\r\n legalName: customer.isEntity ? customer.fullName : null,\r\n storeCode: storeCode ? storeCode : customer.storeCodes[0]\r\n },\r\n customerId: customer.id,\r\n isEntity: customer.isEntity,\r\n isInCustomerPortal: isInCustomerPortal\r\n })\r\n\r\n if (response.data) {\r\n customerApp = new Application(response.data);\r\n return customerApp;\r\n }\r\n } catch(err) {\r\n console.error(err, \"Error Creating Customer Application\")\r\n }\r\n }\r\n }\r\n\r\n export async function completeCustomerApplication(customerApp: Application) {\r\n // This is to pick up where you left off.\r\n // const pathFollowed: [] = customerApp.quoteAppData?.pathFollowed;\r\n // const questionKey: string = pathFollowed[pathFollowed.length - 1];\r\n\r\n const questionKey = customerApp.quoteAppData?.applicationsDataAnswered?.personalInfo?.currentResidence?.residenceStatus?.status != null ? \"currentlyEmployed\" : \"provideEstimateCreditScore\";\r\n await editCustomerApplicationSection(customerApp, questionKey, true);\r\n }\r\n\r\n export async function getAccurateQuoteForCustomerApplication(isCustomerAnEntity: boolean, customerApp: Application) {\r\n const questionKey = customerApp.quoteAppData?.applicationsDataAnswered?.personalInfo?.currentResidence?.residenceStatus?.status != null ? \"currentlyEmployed\" : \"provideEstimateCreditScore\";\r\n await editCustomerApplicationSection(customerApp, questionKey, true);\r\n }\r\n\r\n export async function editPersonalInfoSectionOnCustomerApplication(isCustomerAnEntity: boolean, customerApp: Application) {\r\n const editSectionQuestionKey: 'provideCompanyLegalName' | 'providePrefix' = isCustomerAnEntity ? 'provideCompanyLegalName' : 'providePrefix';\r\n await editCustomerApplicationSection(customerApp, editSectionQuestionKey);\r\n }\r\n\r\n export async function editSSNOnCustomerApplication(customerApp: Application) {\r\n const editSectionQuestionKey: string = 'wantAccureQuoteSSN';\r\n const isSingleQuestionEdit = true;\r\n await editCustomerApplicationSection(customerApp, editSectionQuestionKey, false, false, isSingleQuestionEdit);\r\n }\r\n export async function editHousingSectionOnCustomerApplication(customerApp: Application) {\r\n await editCustomerApplicationSection(customerApp, 'provideMovedInDate');\r\n }\r\n\r\n export async function editEmploymentOnCustomerApplication(customerApp: Application) {\r\n await editCustomerApplicationSection(customerApp, 'currentlyEmployed');\r\n }\r\n\r\n async function editCustomerApplicationSection(customerApp: Application, questionKey: string, resetDateCompleted: boolean = false, isInStore: boolean = false, isSingleQuestionEdit: boolean = null) {\r\n const link = await generateApplicationEditLink(customerApp, questionKey, resetDateCompleted, isInStore, isSingleQuestionEdit);\r\n window.location.href = link; // opens in the current tab\r\n }\r\n\r\n /**\r\n * @param {Application} customerApp\r\n * @param {string} questionKey\r\n * @param {boolean} resetDateCompleted\r\n * @param {string} applicationId\r\n * @param {boolean} isInStore\r\n * @param {boolean} isSingleQuestionEdit - nullable\r\n * @returns A link for the customer to finish the credit app of their application\r\n */\r\n export async function generateApplicationEditLink\r\n (\r\n customerApp: Application,\r\n questionKey: string,\r\n resetDateCompleted = false,\r\n isInStore = false,\r\n isSingleQuestionEdit = null as boolean,\r\n )\r\n {\r\n const storeCode: string = customerApp.storeCode\r\n const applicationId: string = customerApp.id\r\n\r\n const response = await api.applications.generateApplicationEditLink({\r\n questionKey,\r\n resetDateCompleted,\r\n applicationId: applicationId,\r\n storeCode: storeCode,\r\n isInStore: isInStore,\r\n isSingleQuestionEdit,\r\n });\r\n\r\n return response.data;\r\n }\r\n\r\n const CustomerApplicationHelper = {\r\n getPrefilledData,\r\n getCustomerApplication,\r\n hasCustomerApplication,\r\n generateApplicationEditLink,\r\n completeCustomerApplication,\r\n isCreditApplicationComplete,\r\n editSSNOnCustomerApplication,\r\n isCustomerApplicationExpired,\r\n isEditApplicationPastDayLimit,\r\n isCustomerApplicationComplete,\r\n hasCustomerApplicationBeenStarted,\r\n editEmploymentOnCustomerApplication,\r\n createCustomerApplicationFromCustomer,\r\n getAccurateQuoteForCustomerApplication,\r\n isCustomerApplicationPartiallyCompleted,\r\n editHousingSectionOnCustomerApplication,\r\n editPersonalInfoSectionOnCustomerApplication,\r\n isCustomerApplicationExpiredByGlobalSettingsCheck,\r\n isEditApplicationPastDayLimitByGlobalSettingsCheck\r\n }\r\n\r\n export default CustomerApplicationHelper;","import ApplicationsBusinessInfo from '@core/classes/Applications/ApplicationsBusinessInfo';\r\nimport ApplicationsResidence from '@core/classes/Applications/ApplicationsResidence';\r\nimport CustomerEmployment from '@core/classes/Customer/CustomerEmployment';\r\nimport CustomerHousing from '@core/classes/Customer/CustomerHousing';\r\nimport FIMenuCustomerIdentification from '@core/classes/FIMenuCustomerIdentification';\r\nimport moment from 'moment'\r\nimport util from '@core/services/util';\r\n\r\nexport type SupportedLanguages = \"English\"| \"Spanish\";\r\n\r\nexport default class CustomerPersonalInfo {\r\n id?: string = null;\r\n addresses?: ApplicationsResidence[] = [];\r\n cell?: string = null;\r\n dateCreated?: string = null;\r\n dateOfBirth?: string = null;\r\n dob?: string = null;\r\n email?: string = null;\r\n emailAddress?: string = null;\r\n firstName?: string = null;\r\n fullName?: string = null;\r\n generationSuffix?: string = null;\r\n identifications?: FIMenuCustomerIdentification[] = [];\r\n isCitizen?: boolean = null;\r\n isEntity?: boolean = null;\r\n businessInfo?: ApplicationsBusinessInfo = null;\r\n lastName?: string = null;\r\n middleName?: string = null;\r\n phoneNumber?: string = null;\r\n prefix?: string = null;\r\n ssnHashed?: string = null;\r\n ssnLast4?: string = null;\r\n suffix?: string = null;\r\n taxIdHashed?: string = null;\r\n taxIdLast4?: string = null;\r\n workPhone?: string = null;\r\n language?: SupportedLanguages = \"English\";\r\n housingInformation?: CustomerHousing = null; \r\n employmentInformation?: CustomerEmployment = null;\r\n\r\n constructor(init?: Partial) {\r\n if(init){\r\n this.id = init.id;\r\n this.prefix = init.prefix;\r\n this.firstName = init.firstName;\r\n this.middleName = init.middleName;\r\n this.lastName = init.lastName;\r\n this.fullName = init.fullName;\r\n this.isCitizen = init.isCitizen;\r\n this.generationSuffix = init.generationSuffix;\r\n this.suffix = init.suffix;\r\n this.ssnLast4 = init.ssnLast4;\r\n this.ssnHashed = init.ssnHashed;\r\n this.taxIdLast4 = init.taxIdLast4;\r\n this.taxIdHashed = init.taxIdHashed;\r\n this.phoneNumber = init.phoneNumber; //FIXME: old, new is cell\r\n this.cell = init.cell; \r\n this.workPhone = init.workPhone;\r\n this.language = init.language;\r\n this.emailAddress = init.emailAddress; //FIXME: old, new is email\r\n this.email = init.email;\r\n this.isEntity = init.isEntity;\r\n this.addresses = init.addresses?.map((v) => new ApplicationsResidence(v)) ?? [];\r\n this.identifications = init.identifications?.map((v) => new FIMenuCustomerIdentification(v)) ?? [];\r\n this.housingInformation = init.housingInformation; \r\n this.employmentInformation = init.employmentInformation = null;\r\n\r\n if (init.dateCreated) {\r\n this.dateCreated = moment(init.dateCreated, [\"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\", \"MM/DD/YYYY\"]).format(\"MM/DD/YYYY\")\r\n }\r\n\r\n if (init.dob) {\r\n this.dob = moment(init.dob, [\"YYYY-MM-DDTHH:mm:ss\", \"MM/DD/YYYY\"]).format(\"MM/DD/YYYY\")\r\n }\r\n\r\n if (init.dateOfBirth) { // FIXME: this is old, new one is dob.\r\n this.dateOfBirth = moment(init.dateOfBirth, [\"YYYY-MM-DDTHH:mm:ss\", \"MM/DD/YYYY\"]).format(\"MM/DD/YYYY\")\r\n }\r\n\r\n this.updateFullName();\r\n }\r\n }\r\n\r\n updateFullName() {\r\n if (!this.isEntity && this.firstName && this.lastName) {\r\n const concatenatedName = this.firstName.concat(' ').concat(this.lastName);\r\n this.fullName = util.toProperCase(concatenatedName);\r\n }\r\n }\r\n\r\n addDashesToPhoneNumber() {\r\n const phone = this.cell ?? this.phoneNumber\r\n return util.formatPhoneNumber(phone);\r\n }\r\n}","import moment from 'moment'\r\nexport default class PlaidIDVOverride {\r\n\r\n // isIDVSkipped: boolean;\r\n // skipReason: string | null;\r\n // skippedBy: SkippedBy | null;\r\n\r\n constructor(init) {\r\n if(init){\r\n this.isIDVSkipped = init.isIDVSkipped\r\n this.skipReason = init.skipReason\r\n this.skippedBy = new SkippedBy(init.skippedBy)\r\n this.timestamp = init.timestamp\r\n } else {\r\n this.isIDVSkipped = false\r\n this.skipReason = null\r\n this.skippedBy = new SkippedBy()\r\n this.timestamp = moment().utc().toDate();\r\n }\r\n }\r\n\r\n}\r\n\r\n\r\nclass SkippedBy {\r\n constructor(init) {\r\n if(init) {\r\n this.employeeNumber = init.employeeNumber;\r\n this.employeeName = init.employeeName;\r\n } else {\r\n this.employeeNumber = null;\r\n this.employeeName = null;\r\n }\r\n }\r\n}","import { CreationSource, RedFlagsStatus } from '@core/classes/SharedEnums'\r\nimport CustomerPersonalInfo from \"./CustomerPersonalInfo\";\r\nimport IDVOverride from \"@core/classes/PlaidIDVOverride\";\r\n\r\nexport default class CustomerRecord extends CustomerPersonalInfo {\r\n createdFrom: CreationSource = CreationSource.Unknown;\r\n creditBureaursPulled?: any; //FIXME: Make Credit Bureau an actual ENUM\r\n customerName?: string = null;\r\n customerNumber?: string = null;\r\n idvOverride?: IDVOverride[] = [];\r\n isArchived?: boolean = null;\r\n isIDVSkipped?: boolean = false;\r\n plaidIDVOverride?: IDVOverride = new IDVOverride();\r\n redFlagStatus?: RedFlagsStatus.Blank;\r\n statusIDV?: any;\r\n storeCodes?: string[] = [];\r\n customerApplicationStatus?: any;\r\n constructor(init?: Partial) {\r\n if(init) {\r\n super(init);\r\n this.customerNumber = init.customerNumber; \r\n this.customerName = init.customerName; \r\n this.storeCodes = init.storeCodes; \r\n this.createdFrom = init.createdFrom ?? CreationSource.Unknown; \r\n this.redFlagStatus = init.redFlagStatus; \r\n this.creditBureaursPulled = init.creditBureaursPulled \r\n this.statusIDV = init.statusIDV;\r\n this.plaidIDVOverride = init.plaidIDVOverride; \r\n this.idvOverride = init.idvOverride?.map(x => new IDVOverride(x)) ?? []\r\n this.isIDVSkipped = init.isIDVSkipped;\r\n this.isArchived = init.isArchived;\r\n this.customerApplicationStatus = init.customerApplicationStatus;\r\n } else {\r\n super();\r\n }\r\n }\r\n\r\n /**\r\n * @param {CreationSource} createdFrom \r\n * @method CREATE the customer; if it matches another customer; it'll return that customer.\r\n */\r\n // async save(createdFrom: CreationSource) {\r\n // if (this.isEntity) this.dob = null;\r\n // this.createdFrom = createdFrom;\r\n // const response = await api.customers.createCustomer(this)\r\n // }\r\n}","\r\nimport { CBC_REPORT_TYPES } from \"@core/classes/Enums\"\r\nimport api from '@core/services/api'\r\n\r\nexport default class FIMenuCreditReport {\r\n\r\n // flags: CreditReportFlag | null;\r\n // id: string | null;\r\n // reports: CreditReportReports | null;\r\n\r\n constructor(init) {\r\n if(init){\r\n this.flags = init.flags?.map((v) => new CreditReportFlags(v)) ?? []\r\n this.id = init.id\r\n this.reports = init.reports?.map((v) => new CreditReportReportType(v)) ?? []\r\n this.createdAt = init.createdAt\r\n this.lastCreditPull = init.lastCreditPull\r\n this.selectedPulls = init.selectedPulls?.map((v) => new SelectedPulls(v)) ?? []\r\n } else {\r\n this.flags = []\r\n this.id = null\r\n this.reports = []\r\n this.createdAt = null\r\n this.lastCreditPull = null\r\n\t this.selectedPulls = []\r\n }\r\n\r\n this.OFAC = {\r\n report: () => this.getReportByType(CBC_REPORT_TYPES.OFAC),\r\n flags: () => this.getFlagsByType(0), // MAKE ENUM FOR REDFLAG TYPES.,\r\n isOfacNoHit: () => {\r\n const ofacReport = this.OFAC.report()\r\n const hasId = ofacReport?.physicalReportId != null && ofacReport?.physicalReportId != \"\"\r\n\r\n return hasId && !ofacReport.error.hasError\r\n }\r\n }\r\n }\r\n\r\n isOfacNA () {\r\n if(this.OFAC.flags() == null) return true\r\n\r\n return this.OFAC.flags()?.redflags.length == 0 && this.OFAC.report()?.error.message == 'N/A'\r\n }\r\n getReportFromType(reqReportType) {\r\n if (reqReportType == null) return null;\r\n\r\n let reportType = reqReportType\r\n\r\n if(typeof reportType == 'string'){\r\n reportType = CBC_REPORT_TYPES.reportTypeStringToEnum(reqReportType)\r\n }\r\n\r\n return this.reports.find((report) => report.type == reportType)\r\n }\r\n\r\n async saveFlags(customerId){\r\n return await api.creditreport.updateRedFlags(this, customerId);\r\n }\r\n\r\n flagsCount(){\r\n let counter = 0;\r\n\r\n const totalCount = this.flags.reduce((accumulator, value) =>{\r\n if (value.isValidated() == false) accumulator++\r\n return accumulator\r\n }, counter)\r\n\r\n return totalCount;\r\n }\r\n\r\n experian(){\r\n return this.getReportByType(CBC_REPORT_TYPES.XPN)\r\n }\r\n\r\n equifax(){\r\n return this.getReportByType(CBC_REPORT_TYPES.EFX)\r\n }\r\n\r\n transUnion(){\r\n return this.getReportByType(CBC_REPORT_TYPES.TU)\r\n }\r\n\r\n OFACReport(){\r\n return this.getReportByType(CBC_REPORT_TYPES.OFAC)\r\n }\r\n MLAReport(){\r\n return this.getReportByType(CBC_REPORT_TYPES.MLA)\r\n }\r\n\r\n getReportByType(type){\r\n return this.reports.find(x => x.type == type)\r\n }\r\n\r\n getFlagsByType(type){\r\n return this.flags.find(x => x.type == type )\r\n }\r\n\r\n /**\r\n * @param {object} customer\r\n * @returns boolean true if any of the customer's personal info is null\r\n */\r\n customerIsUnableToPullCreditReport(customer) {\r\n let customerData = [\r\n customer.firstName,\r\n customer.lastName,\r\n customer.address,\r\n customer.city,\r\n customer.state,\r\n customer.zip,\r\n customer.county,\r\n customer.email,\r\n customer.cell,\r\n customer.dob,\r\n ];\r\n return customerData.some(value => value === null);\r\n }\r\n\r\n /**\r\n * @param {enum / int} reportType\r\n * @returns Boolean True if the given report type is NOT Ofac or MLA.\r\n */\r\n isABureau(reportType) {\r\n return CBC_REPORT_TYPES.reportTypeEnumToString(reportType) !== 'OFAC' && CBC_REPORT_TYPES.reportTypeEnumToString(reportType) !== 'MLA'\r\n }\r\n\r\n}\r\n\r\nclass CreditReportFlags{\r\n\r\n /* redflags : [] | null\r\n success: boolean | null;\r\n type: number | null // enum */\r\n\r\n constructor(init) {\r\n if (init) {\r\n this.redflags = init.redflags.map((redFlag) => new RedFlag(redFlag));\r\n this.type = init.type\r\n } else {\r\n this.redflags = null\r\n this.type = null\r\n }\r\n }\r\n\r\n //change to hasMissingComment\r\n isValidated() {\r\n return !this.redflags.some(flag => !flag.comment);\r\n }\r\n}\r\n\r\nclass RedFlag {\r\n constructor(init) {\r\n if(init){\r\n this.comment = init.comment;\r\n this.commentDate = init.commentDate;\r\n this.flagDate = init.flagDate;\r\n this.id = init.id;\r\n this.reason = init.reason;\r\n this.reviewedBy = init.reviewedBY;\r\n this.commentAlreadyExists = this.commentAlreadyExists(this.comment);\r\n //if there is comment, then make it true. if the new value is not an empty string, then its valid. if it is an empty string. its invalid.\r\n }\r\n else{\r\n this.comment = null;\r\n this.commentDate = null;\r\n this.flagDate = null;\r\n this.id = null;\r\n this.reason = null;\r\n this.reviewedBy = null;\r\n }\r\n }\r\n\r\n commentAlreadyExists(comment) {\r\n return comment ? true : false;\r\n }\r\n}\r\n\r\nclass CreditReportReportType {\r\n\r\n /* physicalReport: string | null\r\n physicalReportId: string | null\r\n score: string | null\r\n type: number | null */\r\n\r\n constructor(init) {\r\n if (init){\r\n this.physicalReport = init.physicalReport\r\n this.physicalReportId = init.physicalReportId\r\n this.score = init.score\r\n this.type = init.type\r\n this.reportDate = init.reportDate\r\n this.error = new BureauError(init.error)\r\n this.reportMessages = init.reportMessages\r\n } else {\r\n this.physicalReport = null\r\n this.physicalReportId = null\r\n this.score = null\r\n this.type = null\r\n this.reportDate = null\r\n this.error = new BureauError()\r\n this.reportMessages = null\r\n }\r\n }\r\n\r\n\r\n}\r\n\r\nclass BureauError{\r\n constructor(init) {\r\n if(init){\r\n this.message = init.message\r\n this.hasError = init.hasError\r\n this.code = init.code\r\n } else{\r\n this.message = null\r\n this.hasError = null\r\n this.code = null\r\n }\r\n }\r\n}\r\n\r\n/*\r\n physicalReportId: string | null\r\n bureauType: string | null\r\n*/\r\nclass SelectedPulls {\r\n\tconstructor(init) {\r\n\t\tif(init) {\r\n\t\t\tthis.physicalReportId = init.physicalReportId;\r\n\t\t\tthis.bureauType = init.bureauType;\r\n\t\t\tthis.dateSelected = init.dateSelected;\r\n\t\t} else {\r\n\t\t\tthis.physicalReportId = null;\r\n\t\t\tthis.bureauType = null;\r\n\t\t\tthis.dateSelected = null;\r\n\t\t}\r\n\t}\r\n}","import ENUMS from \"@core/classes/Enums\"\r\nexport default class FIMenuCreditPulls {\r\n\r\n // customerApplicationID: string | null;\r\n // dateCreated: string | null;\r\n // id: string | null;\r\n // lastModified: string | null;\r\n // primaryCustomerID: string | null;\r\n // redFlags: RedFlag | null;\r\n // request: Request | null;\r\n // Response: Response | null;\r\n\r\n constructor(init) {\r\n if(init){\r\n this.customerApplicationID = init.customerApplicationID\r\n this.dateCreated = init.dateCreated\r\n this.id = init.id\r\n this.lastModified = init.lastModified\r\n this.primaryCustomerID = init.primaryCustomerID\r\n this.redFlags = init.redFlags?.map((rf) => new RedFlag(rf)) ?? []\r\n this.request = new Request(init.request)\r\n this.response = init.response\r\n } else {\r\n this.customerApplicationID = null\r\n this.dateCreated = null\r\n this.id = null\r\n this.lastModified = null\r\n this.primaryCustomerID = null\r\n this.redFlags = []\r\n this.request = new Request()\r\n this.response = null\r\n }\r\n }\r\n\r\n getCreditPullsFromType(cp) {\r\n if(this.request.header_data.action == cp) {\r\n return this.response.creditreport.report\r\n }\r\n\r\n }\r\n\r\n filteredPullHistoryForBureau(reportType) {\r\n let bureauType = ENUMS.CBC_REPORT_TYPES.reportTypeEnumToString(reportType)\r\n let creditPulls = this.customer.creditPulls\r\n let filter = creditPulls.filter((cp) => {\r\n return cp.request.header_data.action == bureauType\r\n })\r\n return filter;\r\n }\r\n\r\n}\r\n\r\nclass RedFlag {\r\n constructor(init) {\r\n if(init){\r\n this.code = init.code;\r\n this.reason = init.reason;\r\n this.type = init.type;\r\n }\r\n else{\r\n this.code = null\r\n this.reason = null\r\n this.type = null\r\n }\r\n }\r\n}\r\n\r\nclass Request {\r\n constructor(init) {\r\n if(init) {\r\n this.header_data = new HeaderData(init.header_data)\r\n } else {\r\n this.header_data = new HeaderData();\r\n }\r\n }\r\n}\r\n\r\n\r\n// action: string | null;\r\n// products: string | null;\r\n// productName: string | null;\r\nclass HeaderData {\r\n constructor(init) {\r\n if(init) {\r\n this.action = init.action // TU, EFX, OFAC,\r\n this.products = init.products // THIS WILL BE FOR THE VERSION TYPE\r\n // this.productName = init.productName\r\n } else {\r\n this.action = null;\r\n this.products = null;\r\n // this.productName = null;\r\n }\r\n }\r\n}\r\n\r\n","import moment from 'moment'\r\nimport api from \"@core/services/api\";\r\nimport ENUMS from \"@core/classes/Enums\";\r\nimport $modal from \"@core/services/modal\";\r\nimport modalInfo from \"@core/modals/modalInfo\";\r\nimport util from '@core/services/util'\r\n\r\nconst CBCHelper = {\r\n /**\r\n * @param {object} customer\r\n * @returns CBC report using customer id from customer application\r\n */\r\n async getCBCReportByCustomerId(id) {\r\n if (!id) return null;\r\n\r\n let response = await api.cbc.getReportsByCustomerID(id)\r\n\r\n if (response.status == 200) return response;\r\n else console.log(\"Error retrieving cbc report with app id\");\r\n },\r\n\r\n /**\r\n *\r\n * @param {string} id\r\n * @param {string} dealId\r\n * @returns CBC Credit Report\r\n */\r\n async getCreditReport(id = null, dealId = null) {\r\n try {\r\n let response = await api.creditreport.getByCustomerId(id, dealId);\r\n if(response.status == 200 ) {\r\n return response\r\n }\r\n } catch (error) {\r\n console.error(\"Error fetching credit report:\", error);\r\n }\r\n },\r\n\r\n /**\r\n *\r\n * @param {Date} date\r\n * @returns Boolean, if its within 30 days it is true\r\n */\r\n isWithin30Days(date) {\r\n let lastModified = util.toMoment(date).utc(true);\r\n let timeDifference = moment().diff(lastModified, 'days');\r\n return timeDifference < 30;\r\n },\r\n\r\n /**\r\n * @param {object} store\r\n * @returns {boolean} Checks if the store has active CBC Credentials based on store partner codes.\r\n */\r\n isEnrolledWithCBC(store) {\r\n return store.partnerCodes?.find(\r\n (data) => data.type === ENUMS.PARTNER_CODES.CBC_CUSTOMERID\r\n );\r\n },\r\n\r\n /**\r\n * @param {object} store\r\n * @returns {boolean} Checks if the store has CBC enabled (the select box on store settings).\r\n */\r\n isCBCEnabled(store) {\r\n return store?.storeSettings?.isCBCEnabled ?? false;\r\n\r\n },\r\n\r\n // USER CREDS SECTION //\r\n\r\n /**\r\n * @param {object} store\r\n * @param {object} codeList\r\n * @param {class} cbcSettings\r\n * @returns gets the global credentials saved from key value index.\r\n */\r\n async getUserCredentials(storeCode, cbcSettings) {\r\n const response = await api.cbc.getUserCreds(storeCode);\r\n if (response && response.data) {\r\n cbcSettings.credentials.customerID = cbcSettings.credentials.customerID ?? response.data.credentials.customerID;\r\n cbcSettings.credentials.masterID = cbcSettings.credentials.masterID ?? response.data.credentials.masterID;\r\n cbcSettings.credentials.masterPassword = response.data.credentials.masterPassword;\r\n cbcSettings.credentials.userID = cbcSettings.credentials.userID ?? response.data.credentials.userID;\r\n cbcSettings.credentials.userPassword = response.data.credentials.userPassword;\r\n cbcSettings.credentials.masterPasswordLastUpdated = response.data.credentials.masterPasswordLastUpdated;\r\n cbcSettings.credentials.userPasswordLastUpdated = response.data.credentials.userPasswordLastUpdated;\r\n return response;\r\n }\r\n },\r\n\r\n /**\r\n * @param {object} store\r\n * @param {object} codeList\r\n * @param {class} cbcSettings\r\n * @returns Global credentials new master PW\r\n */\r\n async generateMasterPassword(store, codeList, cbcSettings) {\r\n let response = await api.cbc.resetMasterPassword(cbcSettings);\r\n if (response.data.success) {\r\n cbcSettings.credentials.masterPassword = response.data.credentials.masterPassword;\r\n cbcSettings.credentials.masterPasswordLastUpdated = response.data.credentials.masterPasswordLastUpdated;\r\n return true;\r\n }\r\n },\r\n\r\n /**\r\n * @param {object} store\r\n * @param {object} codeList\r\n * @param {class} cbcSettings\r\n * @returns a new global user password\r\n */\r\n async generateUserPassword(store, codeList, cbcSettings) {\r\n let response = await api.cbc.resetUserPassword(cbcSettings);\r\n if (response && response.data) {\r\n if (response.data.success) {\r\n cbcSettings.credentials.userPassword = response.data.credentials.userPassword;\r\n cbcSettings.credentials.masterPasswordLastUpdated = response.data.credentials.userPasswordLastUpdated;\r\n return true;\r\n }\r\n }\r\n },\r\n\r\n /**\r\n *\r\n * @param {integer} type\r\n * @param {string} code\r\n * @param {object} store\r\n * @param {object} codeList\r\n * @function updates the partner code for the store's values. passwords are no longer stored in a partner code.\r\n */\r\n updatePartnerCode(type, code, store, codeList) {\r\n if (code) {\r\n let partnerCode = store.partnerCodes.find((pc) => pc.type === type);\r\n\r\n if (partnerCode) {\r\n partnerCode.code = code;\r\n } else {\r\n store.partnerCodes.push({ type, code });\r\n codeList.push(ENUMS.PARTNER_CODES_TYPES.find((pc) => pc.type === type));\r\n }\r\n } else {\r\n // this removes a partner code\r\n store.partnerCodes = store.partnerCodes.filter((pc) => pc.type !== type);\r\n codeList = codeList.filter((c) => c.type !== type);\r\n }\r\n },\r\n\r\n /**\r\n * @param {object} store\r\n * @param {object} codeList\r\n * @param {class} cbcSettings\r\n * @function Installs the CBC creds for global\r\n */\r\n async installCBC(store, codeList, cbcSettings) {\r\n\r\n let response = await api.cbc.addUser(cbcSettings);\r\n if (response && response.data) {\r\n if (response.data.success) {\r\n cbcSettings.credentials.userID = response.data.credentials.userID;\r\n cbcSettings.credentials.userPassword = response.data.credentials.userPassword;\r\n cbcSettings.credentials.masterID = response.data.credentials.masterID;\r\n cbcSettings.credentials.masterPassword = response.data.credentials.masterPassword;\r\n return true;\r\n }\r\n }\r\n },\r\n\r\n /**\r\n * @param {object} store\r\n * @param {object} codeList\r\n * @param {class} cbcSettings\r\n * @function Removes the user creds for the globals. just makes the flag disabled, does not delete.\r\n */\r\n\tasync uninstallCBC(store, codeList, cbcSettings) {\r\n\t\tlet response = await api.cbc.deactivate(cbcSettings);\r\n\t\tif (response && response.data) {\r\n\t\tcbcSettings.credentials.customerID = null;\r\n\t\tcbcSettings.credentials.masterID = null;\r\n\t\tcbcSettings.credentials.masterPassword = null;\r\n\t\tcbcSettings.credentials.userID = null;\r\n\t\tcbcSettings.credentials.userPassword = null;\r\n\t\treturn true;\r\n\t\t}\r\n\t},\r\n\r\n\r\n\t/**\r\n\t * @param {object} store\r\n\t * @param {object} codeList\r\n\t * @param {class} cbcSettings\r\n\t * @method opens the confirmation modal\r\n\t */\r\n\topenConfirmMasterPassword(store, codeList, cbcSettings) {\r\n\t\t$modal.open(modalInfo, {\r\n\t\tname: \"modalInfo\",\r\n\t\tpassedData: {\r\n\t\t\ttitle: \"Confirm\",\r\n\t\t\tinfo: \"Are you sure you want to reset the master password ?\",\r\n\t\t\tacceptText: \"Continue\",\r\n\t\t\tcancelText: \"Cancel\",\r\n\t\t},\r\n\t\tbackdrop: true,\r\n\t\tpostFunction: () => this.generateMasterPassword(store, codeList, cbcSettings),\r\n\t\t});\r\n\t},\r\n\t/**\r\n\t * @param {object} customer\r\n\t * @param {string} type\r\n\t * @param {string} addressType\r\n\t * @method opens create a customerApplicant for cbcRequests.\r\n\t */\r\n\tcreateCustomerApplicant(customer, type = \"primary\", addressType = \"current\"){\r\n\t\treturn {\r\n\t\t\tType: type,\r\n\t\t\tPerson_name: {\r\n\t\t\t\tFirst_name: customer.firstName,\r\n\t\t\t\tMiddle_name: customer.middleName,\r\n\t\t\t\tLast_name: customer.lastName,\r\n\t\t\t\tGeneration: customer.suffix,\r\n\t\t\t},\r\n\t\t\tAddress_data: {\r\n\t\t\t\tAddress: {\r\n\t\t\t\t\tType: addressType,\r\n\t\t\t\t\tLine_one: customer.address + (customer.addressExtra != null ? ` ${customer.addressExtra}` : \"\"),\r\n\t\t\t\t\tCity: customer.city,\r\n\t\t\t\t\tState_or_province: customer.state,\r\n\t\t\t\t\tPostal_code: customer.zip,\r\n\t\t\t\t},\r\n\t\t\t},\r\n\t\t\tSocial: customer.ssnHashed,\r\n\t\t\tBirthdate: customer.dob,\r\n\t\t}\r\n\t},\r\n\t\t/**\r\n\t * @param {FIMenuCustomer} customer\r\n\t * @param {object} store\r\n\t * @param {number} reportType\r\n * @param {string} selectedCreditPullVersion\r\n * @param {boolean} automaticPull\r\n\t * @method Makes a credit pull and returns a creditReport based on the selected credit pull version.\r\n\t */\r\n\r\n\tasync pullCredit(customer, store, reportType, selectedCreditPullVersion = null, automaticPull = false, DealId = null, pin = \"\") {\r\n\t\tif (CBCHelper.isCBCEnabled(store)) {\r\n\t\t\tvar applicantArray = [CBCHelper.createCustomerApplicant(customer)]\r\n\r\n\t\t\tlet request = {\r\n\t\t\t\tPrimaryCustomerID: customer.id,\r\n\t\t\t\tStoreCode: store.storeCode,\r\n\t\t\t\tReportType: reportType,\r\n\t\t\t\tApplicantArray: applicantArray,\r\n\t\t\t\tPIN: pin,\r\n\t\t\t\tIsJoint: false,\r\n\t\t\t\tIsHardPull: false,\r\n\t\t\t\tDealId: DealId,\r\n CreditPullVersion: selectedCreditPullVersion,\r\n AutomaticPull: automaticPull\r\n\t\t\t}\r\n\t\t\ttry{\r\n\t\t\t\tlet response = null;\r\n\r\n\t\t\t\tif (reportType == ENUMS.CBC_REPORT_TYPES.OFAC) { // Ofac Report pull\r\n\t\t\t\t\tresponse = await api.cbc.getOfacReport(request);\r\n\t\t\t\t} else { // Bureau credit report\r\n\t\t\t\t\tresponse = await api.cbc.creditPull(request);\r\n\t\t\t\t}\r\n\t\t\t\treturn response.data;\r\n\r\n\t\t\t} catch(err) {\r\n\t\t\t\tconsole.log(\"Error\", err);\r\n\t\t\t\treturn null;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn null;\r\n\t},\r\n\t/**\r\n\t * @param {flags} List of all the flags\r\n\t * @param {object} store\r\n\t * @param {string} reportType\r\n\t * @method opens Makes a credit pull and returns a creditReport.\r\n\t */\r\n\tanyRedflags(flags) {\r\n\t\treturn flags?.some(flag => flag.redflags?.some(redflag => !redflag.comment))\r\n\t},\r\n\r\n /**\r\n *\r\n * @param {string} reportType\r\n * @param {object} customer\r\n * @returns filtered credit pulls by report type\r\n */\r\n getCreditPullsByReportType(reportType, customer) {\r\n let bureauType = ENUMS.CBC_REPORT_TYPES.reportTypeEnumToString(reportType)\r\n let creditPulls = customer.creditPulls\r\n let filter = creditPulls.filter((cp) => {\r\n return cp.request.header_data.action == bureauType\r\n })\r\n return filter;\r\n },\r\n\r\n async saveCreditPullToCreditReport(physicalReportId, bureauType, customerId) {\r\n // we'll send the ID of the credit pull and the bureau type.\r\n try {\r\n let response = await api.cbc.saveCreditPullToCreditReport(physicalReportId, bureauType, customerId);\r\n if(response?.status == 200) {\r\n return response;\r\n }\r\n } catch (error) {\r\n console.log(\"Error\", error)\r\n return;\r\n }\r\n }\r\n\r\n};\r\n\r\nexport default CBCHelper;\r\n","import settings from 'settings';\r\nimport api from '@core/services/api';\r\nimport DocumentAssociations from '@core/classes/DocumentAssociation';\r\n\r\nexport default class PlaidGenerateLinkRequest {\r\n appDomain: string = settings.appDomain;\r\n linkToken: string;\r\n associations: DocumentAssociations[] = [];\r\n storeCode?: string;\r\n phoneNumber?: string;\r\n emailAddress?: string;\r\n\r\n constructor(linkToken: string, associations: DocumentAssociations[], storeCode?: string, phoneNumber?: string, emailAddress?: string) {\r\n this.linkToken = linkToken;\r\n this.associations = associations;\r\n this.storeCode = storeCode;\r\n this.phoneNumber = phoneNumber;\r\n this.emailAddress = emailAddress;\r\n }\r\n\r\n async getPortalLink(): Promise {\r\n const response = await api.plaid.getPlaidPortalLink(this);\r\n return response?.data;\r\n }\r\n\r\n async sendLinkToPortal(): Promise {\r\n const response = await api.plaid.sendLinkToPortal(this);\r\n return response?.data;\r\n }\r\n}","import $modal from \"@core/services/modal\";\r\nimport api from \"@core/services/api\";\r\nimport CustomerRecord from \"@core/classes/Customer/CustomerRecord\";\r\nimport DocumentAssociation from \"@core/classes/DocumentAssociation\";\r\nimport ENUMS from \"@core/classes/Enums\";\r\nimport modalPlaidIDVOverride from \"@core/modals/modalPlaidIDVOverride.vue\";\r\nimport { PlaidCustomerInfo } from \"@core/classes/Plaid/PlaidCustomerInfo\";\r\nimport PlaidGenerateLinkRequest from \"@core/classes/Plaid/PlaidGenerateLinkRequest\";\r\nimport PlaidLinkConfig from \"@core/classes/Plaid/PlaidLinkConfig\";\r\nimport { PlaidUserInfo } from \"@core/classes/Plaid/PlaidUserInfo\";\r\nimport settings from \"settings\";\r\nimport util from \"@core/services/util\";\r\n\r\n/**\r\n * Checks if the given customers pass the store's IDV validation rules. If anyone doesn't pass, the skip modal will be opened.\r\n * @param {store} object The current store that's running the IDV check.\r\n * @param {FIMenuCustomer[]} customers A list of all customers to verify\r\n * @param {string} employeeCode Code of the employee that will be recorded on the Skip reason (if applicable)\r\n * @param {string} employeeName Name of the employee that will be recorded on the Skip reason (if applicable)\r\n * @param {Function} postFunction Post function sent to the IDV Skip Modal\r\n * @returns {boolean} Whether ALL customers pass the IDV validation rules. If `false` is returned, then the skip modal has been opened.\r\n */\r\nexport async function checkForCustomerIdv(\r\n store: any,\r\n customers: any[],\r\n employeeCode: string,\r\n employeeName: string,\r\n postFunction: (() => void) | null = null,\r\n preventOpenSkipModal: boolean = false,\r\n): Promise {\r\n // Don't run check if IDV not enabled\r\n if (!store.storeSettings.isCustomerPlaidIDVEnabled) return true;\r\n\r\n // Can ignore if customer is BUSINESS, SKIPPED IDV, or SESSION IS SUCCESSFUL\r\n const _canIgnoreCustomer = (customer: any): boolean => {\r\n return (\r\n customer.isEntity ||\r\n customer.isIDVSkipped ||\r\n customer.statusIDV === ENUMS.PLAID_VERIFICATION_STATUS.Success.ind\r\n );\r\n };\r\n\r\n // If we can ignore every customer, no need to do anything\r\n if (customers.every(customer => _canIgnoreCustomer(customer))) return true;\r\n\r\n // Only grabbing IDV sessions from customers that can't be ignored\r\n const customersToUpdate = customers.filter((customer: any) => customer.id && !_canIgnoreCustomer(customer));\r\n\r\n // Customer is verified only if we can find a session with the status \"Success\"\r\n const _isCustomerVerified = async (customer: any): Promise<{ isVerified: boolean; customer: any }> => {\r\n const response = await api.plaid.getNewestIdentityVerification(customer.id);\r\n // If an empty object was returned, there was never a session started\r\n if(Object.keys(response.data).length <= 0) {\r\n console.error(\"No existing identity verification for this customer\");\r\n util.toastr('error', 'Error Retrieving Newest Identity Verification', \"No existing identity verification for this customer.\")\r\n return { isVerified: false, customer }\r\n }\r\n // If there was an error from Plaid \r\n if(response?.data?.plaidResponse.error) {\r\n console.error('error', response?.data?.plaidResponse.error.errorMessage)\r\n util.toastr('error', 'Error Retrieving Newest Identity Verification', response?.data?.plaidResponse.error.errorMessage)\r\n }\r\n\r\n const latestSession = response?.data?.plaidResponse;\r\n\r\n if (!latestSession) return { isVerified: false, customer };\r\n\r\n return {\r\n isVerified: latestSession.status === ENUMS.PLAID_VERIFICATION_STATUS.Success.str,\r\n customer,\r\n };\r\n };\r\n\r\n const taskList: Promise<{ isVerified: boolean; customer: any }>[] = [];\r\n customersToUpdate.forEach((customer: any) => {\r\n taskList.push(_isCustomerVerified(customer));\r\n });\r\n\r\n const customersWithVerification = (await Promise.allSettled(taskList)).map(t =>\r\n t.status === \"fulfilled\" ? t.value : { isVerified: false, customer: null },\r\n );\r\n\r\n if (customersWithVerification.some(c => !c.isVerified)) {\r\n if (!preventOpenSkipModal) { // if they Are authorized to skip, let them \r\n const customersToOverride = customersWithVerification.filter(a => !a.isVerified).map(b => b.customer);\r\n openPlaidIdvOverrideModal(customersToOverride, employeeCode, employeeName, postFunction);\r\n }\r\n else if (preventOpenSkipModal) // if we are preventing from opening the skip modal (they don't have permission)\r\n {\r\n util.toastr('error', \"Error\", \"You are unauthorized to skip IDV. Please contact your manager to do so.\", 20000)\r\n }\r\n\r\n return false;\r\n }\r\n\r\n return true;\r\n}\r\n\r\n/**\r\n * Opens the IDV skip modal\r\n * @param {FIMenuCustomer[]} customers A list of customers who are skipping the IDV session\r\n * @param {string} employeeCode The code of the employee who will provide the skip reason\r\n * @param {string} employeeName The name of the employee who will provide the skip reason\r\n * @param {Function} [postFunction=null] An optional post function to run after the Skip Modal has been closed\r\n */\r\nexport function openPlaidIdvOverrideModal(\r\n customers: any,\r\n employeeCode: any,\r\n employeeName: any,\r\n postFunction: any = null,\r\n) {\r\n const customerInfo: any[] = [];\r\n\r\n customers.forEach((customer: any) => {\r\n customerInfo.push({\r\n type: ENUMS.PERSON_TYPES.CUSTOMER,\r\n name: customer.fullName ?? customer.getFullName(),\r\n id: customer.id,\r\n });\r\n });\r\n\r\n $modal.open(modalPlaidIDVOverride, {\r\n name: \"modalPlaidIDVOverride\",\r\n passedData: {\r\n customerInfo,\r\n },\r\n postFunction: async (skipReasons: any) => {\r\n if (!skipReasons || skipReasons.length < 1) return;\r\n\r\n for (let r of skipReasons) {\r\n const override = {\r\n isIDVSkipped: true,\r\n skipReason: r.skipReason,\r\n skippedBy: { employeeNumber: employeeCode, employeeName },\r\n timestamp: new Date(Date.now()),\r\n };\r\n\r\n const customer = customers.find((cust: any) => cust.id == r.id);\r\n customer.idvOverride = customer.idvOverride.filter((x: any) => x.isIDVSkipped == true);\r\n customer.idvOverride.push(override);\r\n\r\n // We usually save in the post function; to be able to provide loading feedback to the FE.\r\n }\r\n\r\n if (postFunction?.constructor?.name === \"AsyncFunction\") {\r\n // If it's asynchronous, await it\r\n await postFunction();\r\n } else if (postFunction != null) {\r\n // If it's not asynchronous, execute it directly\r\n postFunction();\r\n }\r\n },\r\n });\r\n}\r\n\r\nexport async function getCustomersMostRecentIDVStatus(customer: CustomerRecord) {\r\n const id: string = await getIDVSessionID(customer.id);\r\n const plaidIDVResponse = await getIDVSession(true, id, customer);\r\n\r\n if (!plaidIDVResponse) return;\r\n}\r\n\r\n/**\r\n * Gets the most recent IDV session ID for a given customer.\r\n * @param {string} customerId The ID of the customer to lookup\r\n * @return {string} The most recent IDV session ID (if any were found)\r\n */\r\nexport async function getIDVSessionID(customerId: string) {\r\n try {\r\n const response = await api.plaid.getMostRecentIDVSessionID(customerId, ENUMS.DOC_ASSOCIATION.Customer);\r\n\r\n if (response.data) {\r\n return response.data;\r\n } else return null;\r\n } catch (err) {\r\n console.error(err);\r\n return null;\r\n }\r\n}\r\n\r\n// Gets the IDV Session information from Plaid.\r\n// Wether we should update customer\r\nexport async function getIDVSession(updateCustomer = false, sessionId: any = null, customer: CustomerRecord) {\r\n try {\r\n // If we don't pass in a session id, lets grab it ourselves.\r\n if (sessionId == null) {\r\n sessionId = await getIDVSessionID(customer.id);\r\n if (sessionId == null) return null;\r\n }\r\n\r\n const response = await api.plaid.getIdentityVerification(sessionId, customer.storeCodes[0]);\r\n if(response?.data.error) {\r\n console.error('PLAID API ERROR.', response?.data.error);\r\n util.toastr('error', response?.data.error.errorType, response?.data.error.errorMessage);\r\n return null;\r\n }\r\n if (!response?.data) return null;\r\n\r\n const plaidResponse = response.data.plaidResponse;\r\n\r\n if (updateCustomer && plaidResponse) {\r\n // If we get accepted, declined, etc. Anything but in progress, then lets mark it as not skipped.\r\n if (plaidResponse.status !== ENUMS.PLAID_VERIFICATION_STATUS.Active.str) customer.isIDVSkipped = false;\r\n\r\n customer.statusIDV = ENUMS.PLAID_VERIFICATION_STATUS.stringToIndex(plaidResponse.status);\r\n }\r\n\r\n return response.data;\r\n } catch (err) {\r\n console.error(err);\r\n return null;\r\n }\r\n}\r\n\r\n/**\r\n * @param {CustomerRecord} customer\r\n * @param {string} storeCode\r\n * @method Generates a plaid portal link\r\n */\r\nexport async function generatePlaidPortalLink(customer: CustomerRecord) {\r\n try {\r\n const request= await generateMinimumParametersForPlaidPage(\r\n customer,\r\n customer.storeCodes[0],\r\n );\r\n\r\n const link = await request.getPortalLink();\r\n\r\n // window.location.href = generateLinkResponse.data; // opens in the current tab\r\n window.open(link, \"_blank\"); //opens new tab\r\n } catch (err) {\r\n console.error(\"ERROR: \", err);\r\n }\r\n}\r\n\r\nexport async function generateMinimumParametersForPlaidPage(customer: CustomerRecord, storeCode: string) {\r\n // Create Plaid Config\r\n const plaidUser = new PlaidUserInfo({\r\n emailAddress: customer.emailAddress,\r\n phoneNumber: \"+1\" + customer.phoneNumber, // Format: E.164 (ex. +11234567890)\r\n dateOfBirth: customer.dateOfBirth, // moment(customer.dateOfBirth, \"YYYY-MM-DDTHH:mm:ss\").format(\"YYYY-MM-DD\"), // Format: YYYY-MM-DD\r\n name: {\r\n givenName: customer.firstName,\r\n familyName: customer.lastName,\r\n },\r\n address: {\r\n street: customer.addresses[0].addressLine1,\r\n street2: customer.addresses[0].addressLine2,\r\n city: customer.addresses[0].city,\r\n region: customer.addresses[0].state, // ISO 3166-2 subdivision code (ex. state, province, prefecture, zone, etc.)\r\n postalCode: customer.addresses[0].zipCode,\r\n country: customer.addresses[0].country, // Format: ISO 3166-1 alpha-2 two-letter code\r\n },\r\n idNumber: null,\r\n isIdEncrypted: false,\r\n });\r\n\r\n const plaidUserInfo = (settings.plaidEnvironment !== 'SANDBOX')\r\n ? plaidUser\r\n : PlaidUserInfo.getSandboxUser();\r\n\r\n const plaidConfig: PlaidLinkConfig = new PlaidLinkConfig({\r\n name: \"Saturn\",\r\n countries: [ENUMS.PLAID_COUNTRIES.UnitedStates],\r\n linkLanguage: ENUMS.PLAID_LANGUAGES.English,\r\n productsToInit: [ENUMS.PLAID_PRODUCTS.IdentityVerification],\r\n userData: plaidUserInfo,\r\n });\r\n\r\n // Generate Link Token\r\n const prepopulatedResponse = await plaidConfig.prepopulateIdentityVerification(customer.id, storeCode);\r\n if (!prepopulatedResponse?.data || prepopulatedResponse.data.error) {\r\n const errorCause = prepopulatedResponse?.data?.error ?? \"No response from server.\";\r\n throw new Error(\"An error occurred when pre-populating the IDV session.\", { cause: errorCause });\r\n }\r\n\r\n const plaidCustomerInfo = new PlaidCustomerInfo();\r\n plaidCustomerInfo.customerId = customer.id;\r\n const linkTokenResponse = await plaidConfig.createLinkToken(plaidCustomerInfo);\r\n\r\n const linkToken = linkTokenResponse.data.linkToken;\r\n\r\n // Create Document Association\r\n const customerAssociation: DocumentAssociation = new DocumentAssociation({\r\n id: customer.id,\r\n type: ENUMS.DOC_ASSOCIATION.Customer,\r\n });\r\n\r\n const request = new PlaidGenerateLinkRequest(linkToken, [customerAssociation], customer.storeCodes[0]);\r\n return request;\r\n}\r\n\r\nconst PlaidHelper = {\r\n getIDVSession,\r\n getIDVSessionID,\r\n checkForCustomerIdv,\r\n generatePlaidPortalLink,\r\n openPlaidIdvOverrideModal,\r\n getCustomersMostRecentIDVStatus,\r\n generateMinimumParametersForPlaidPage,\r\n};\r\n\r\nexport default PlaidHelper;\r\n","export default class CustomerMetadata {\r\n idvSeen: boolean = false;\r\n\r\n constructor(init: Partial) {\r\n this.idvSeen = init?.idvSeen ||init?.idvSeen || this.idvSeen;\r\n }\r\n}","import CustomerRecord from \"@core/classes/Customer/CustomerRecord\"\r\nimport { generateMinimumParametersForPlaidPage } from \"@core/helpers/Providers/plaid-helper\";\r\nimport LogRocket from \"logrocket\";\r\nimport { PLAID_VERIFICATION_STATUS } from \"@core/classes/Enums\";\r\nimport util from \"@core/services/util\";\r\n\r\n\r\n/**\r\n * Checks if the store has IDV enabled (the select box on store settings)\r\n * @param {object} store The store in question\r\n * @returns {boolean} Whether or not the IDV check is enabled.\r\n */\r\nexport function isIDVEnabled(store: any): boolean {\r\n return store?.storeSettings?.isCustomerPlaidIDVEnabled ?? false;\r\n }\r\n\r\n\r\n/**\r\n * @param {CustomerRecord} customer\r\n * @returns Boolean, Either complete or incomplete, for Pill label on Pill.vue for Customer portal\r\n */\r\nexport function getIDVPillLabel(customer: CustomerRecord): string {\r\n const status: 'Complete' | 'Incomplete' | \" \" | 'Failed'= getIDVStatus(customer);\r\n const englishCompleted = \"Completed\";\r\n const englishIncomplete = \"Incomplete\";\r\n const englishRejected = \"Pending\";\r\n const spanishCompleted = \"Completado\";\r\n const spanishIncomplete = \"Incompletado\"\r\n const spanishRejected = \"Pendiente\";\r\n\r\n const incompleteText = customer.language == \"English\" ? englishIncomplete : spanishIncomplete;\r\n const rejectedText = customer.language == \"English\" ? englishRejected : spanishRejected;\r\n\r\n const completedText = customer.language == \"English\" ? englishCompleted : spanishCompleted;\r\n\r\n if (status == 'Incomplete') return incompleteText;\r\n if (status == 'Complete') return completedText;\r\n if (status == 'Failed') return rejectedText;\r\n}\r\n\r\n/**\r\n * @param {CustomerRecord} customer\r\n * @returns Error or Success, for the Pill status color on Pill.vue for Customer portal\r\n */\r\nexport function getIDVPillStatusColor(customer: CustomerRecord): string {\r\n const status: 'Complete' | 'Incomplete' | \" \" | \"Failed\" = getIDVStatus(customer);\r\n if (status === 'Incomplete') return 'error';\r\n if (status === 'Failed') return 'warning';\r\n if (status === 'Complete') return 'success';\r\n}\r\n\r\n/**\r\n * @param {CustomerRecord} customer \r\n * @returns Helper function that returns complete, incomplete, or empty string (to not show) for the Pill.vue in Customer portal\r\n */\r\nfunction getIDVStatus(customer: CustomerRecord): 'Complete' | 'Incomplete' | \" \" | \"Failed\" {\r\n if (!customer?.id) return \" \";\r\n\r\n // If customer skipped IDV, use that status instead so we can override the \"Failed\" status when F&I have passed the session \r\n const customerSkippedIDV: boolean = customer.idvOverride && customer.idvOverride.length > 0 && customer.isIDVSkipped;\r\n const customerPassedIDV: boolean = customer.statusIDV == PLAID_VERIFICATION_STATUS.Success.ind;\r\n if (customerPassedIDV || customerSkippedIDV) return 'Complete';\r\n\r\n const failedStatus: boolean = customer.statusIDV == PLAID_VERIFICATION_STATUS.Failed.ind;\r\n if (failedStatus) return 'Failed';\r\n\r\n const neverStartedIDV: boolean = customer.statusIDV == null;\r\n const incompleteStatus: boolean = customer.statusIDV !== PLAID_VERIFICATION_STATUS.Success.ind;\r\n if(neverStartedIDV || incompleteStatus) return 'Incomplete';\r\n}\r\n\r\n/**\r\n * @param {CustomerRecord} customer\r\n * @returns Boolean, if the customer has idv override items in the list, or if they are currently skipped,\r\n * or if they are any status other than Accepted.\r\n */\r\nexport function disableIDVButton(customer: CustomerRecord): boolean {\r\n if(!customer?.id) return true;\r\n return customer && customer.statusIDV == 1;\r\n }\r\n\r\n // export async function idvAction(customer: CustomerRecord) {\r\n // await PlaidHelper.generatePlaidPortalLink(customer);\r\n //}\r\n\r\n export async function idvAction(router: any, id: string, customer: CustomerRecord) {\r\n let linkToken: string | undefined;\r\n let associations: any[] | undefined;\r\n try {\r\n const response = await generateMinimumParametersForPlaidPage(customer, customer.storeCodes[0])\r\n linkToken = response.linkToken;\r\n associations = response.associations;\r\n } catch (error) {\r\n util.toastr('error', 'Error', 'Error initiating identity verification.')\r\n LogRocket.error(error)\r\n }\r\n\r\n if (linkToken && associations) {\r\n router.push({name: 'identity-verification', query: {\r\n id: id, \r\n linkToken: linkToken, \r\n customerAssociations: JSON.stringify(associations) \r\n }, \r\n })\r\n }\r\n }\r\nconst IDVHelper = {\r\n idvAction,\r\n isIDVEnabled,\r\n getIDVStatus,\r\n getIDVPillLabel,\r\n disableIDVButton,\r\n getIDVPillStatusColor\r\n}\r\n\r\nexport default IDVHelper;","import { required, between, minLength, maxLength, numeric, email, requiredIf } from '@vuelidate/validators'\r\nimport { validZIPUS, validZIPInternational, validSSN, isSSNUsed, validDate, validDateOfBirth, validDriversLicenseExpirationDate, validName } from '@core/services/custom-validators'\r\nimport moment from 'moment'\r\nimport FIMenuCustomerIdentification from \"@core/classes/FIMenuCustomerIdentification\"\r\nimport ENUMS from \"@core/classes/Enums\"\r\nimport api from '@core/services/api'\r\nimport util from \"@core/services/util\"\r\nimport FIMenuCreditReport from './FIMenuCreditReport'\r\nimport DocumentAssociation from './DocumentAssociation'\r\nimport FIMenuCreditPulls from './FIMenu/FIMenuCreditPulls'\r\nimport PlaidIDVOverride from './PlaidIDVOverride'\r\nimport settings from 'settings';\r\nimport Application from './Applications/Application'\r\nimport CBCHelper from '@core/helpers/Providers/cbc-helper'\r\nimport PlaidHelper from '@core/helpers/Providers/plaid-helper'\r\nimport auth from '@core/services/auth';\r\nimport LogRocket from 'logrocket';\r\nimport CustomerMetadata from \"@core/classes/CustomerMetadata\"\r\nimport IDVHelper from '@core/helpers/idv-helper'\r\nimport ApplicationsBusinessInfo from './Applications/ApplicationsBusinessInfo'\r\n\r\n\r\nexport default class FIMenuCustomer {\r\n constructor(init) {\r\n if (init) {\r\n this.id = init.id;\r\n this.applicationId = init.applicationId;\r\n this.associatedCustomers = init.associatedCustomers // List \r\n this.businessInfo = new ApplicationsBusinessInfo(init.businessInfo);\r\n this.isEntity = init.isEntity;\r\n this.prefix = init.prefix;\r\n this.suffix = init.suffix;\r\n this.fullName = init.fullName;\r\n this.firstName = init.firstName;\r\n this.middleName = init.middleName;\r\n this.lastName = init.lastName;\r\n this.isCitizen = init.isCitizen;\r\n this.address = init.address;\r\n this.addressExtra = init.addressExtra;\r\n this.city = init.city;\r\n this.state = init.state;\r\n this.zip = init.zip;\r\n this.county = init.county;\r\n this.country = init.country;\r\n this.phone = init.phone;\r\n this.email = init.email;\r\n this.signature = init.signature;\r\n this.initials = init.initials;\r\n this.cell = init.cell;\r\n this.workPhone = init.workPhone;\r\n this.customerApplication = new Application(init.customerApplication);\r\n this.creditReport = new FIMenuCreditReport(init.creditReport);\r\n this.validationTypes = FIMenuCustomer.validationTypes;\r\n this.plaidIDVOverride = init.plaidIDVOverride ?? null;\r\n this.idvOverride = init.idvOverride?.map(x => new PlaidIDVOverride(x)) ?? []\r\n this.isThereAnyUnsavedCustomerChanges = !!init.isThereAnyUnsavedCustomerChanges\r\n this.statusIDV = init.statusIDV;\r\n this.isIDVSkipped = init.isIDVSkipped;\r\n this.language = init.language;\r\n this.customerApplicationStatus = init.customerApplicationStatus;\r\n this.metadata = new CustomerMetadata(init.metadata); \r\n this.currentSignatureId = init.currentSignatureId ?? null;\r\n this.currentInitialsId = init.currentInitialsId ?? null;\r\n\r\n if (init.dob) {\r\n this.dob = moment(init.dob, [\"YYYY-MM-DDTHH:mm:ss\", \"MM/DD/YYYY\"]).format(\"MM/DD/YYYY\")\r\n }\r\n else {\r\n this.dob = null;\r\n }\r\n\r\n this.creditScore = init.creditScore;\r\n this.ssnLast4 = init.ssnLast4;\r\n this.ssnHashed = init.ssnHashed;\r\n this.isSalesTaxExempt = init.isSalesTaxExempt;\r\n\r\n if (init.identifications && Array.isArray(init.identifications)) {\r\n this.identifications = init.identifications.map(a => new FIMenuCustomerIdentification(a));\r\n }\r\n else {\r\n this.identifications = [];\r\n }\r\n\r\n // credit pulls\r\n if (init.creditPulls && Array.isArray(init.creditPulls)) {\r\n this.creditPulls = init.creditPulls.map(a => new FIMenuCreditPulls(a));\r\n }\r\n else {\r\n this.creditPulls = [];\r\n }\r\n\r\n //clean up\r\n this.updateFullName();\r\n\r\n\r\n } else {\r\n this.id = null;\r\n this.applicationId = null;\r\n this.associatedCustomers = [];\r\n this.businessInfo = null;\r\n this.isEntity = false;\r\n this.prefix = null;\r\n this.suffix = null;\r\n this.fullName = null;\r\n this.firstName = null;\r\n this.middleName = null;\r\n this.lastName = null;\r\n this.isCitizen = null;\r\n this.address = null;\r\n this.addressExtra = null;\r\n this.city = null;\r\n this.state = null;\r\n this.zip = null;\r\n this.county = null; //simcha added\r\n this.country = null; //Gretel added\r\n this.phone = null;\r\n this.email = null;\r\n this.signature = null;\r\n this.initials = null;\r\n this.currentSignatureId = null;\r\n this.currentInitialsId = null;\r\n this.cell = null;\r\n this.workPhone = null;\r\n this.creditReport = new FIMenuCreditReport();\r\n this.creditPulls = [];\r\n this.validationTypes = null;\r\n this.dob = null; //simcha added\r\n this.creditScore = null;\r\n this.ssnLast4 = null; //simcha added\r\n this.ssnHashed = null; //simcha added\r\n this.identifications = []; //simcha added\r\n this.isSalesTaxExempt = null;\r\n this.plaidIDVOverride = null;\r\n this.idvOverride = [];\r\n this.isThereAnyUnsavedCustomerChanges = false\r\n this.customerApplication = null;\r\n this.statusIDV = null;\r\n this.isIDVSkipped = false;\r\n this.language = null;\r\n this.customerApplicationStatus = null;\r\n this.metadata = new CustomerMetadata();\r\n }\r\n\r\n //ADD DRIVERS LICENSE IF ITS MISSING\r\n if (!this.identifications.some(i => i.type == ENUMS.CUSTOMER_IDENTIFICATION_TYPES.DriversLicense)) {\r\n let driverLicenseIdentity = new FIMenuCustomerIdentification();\r\n driverLicenseIdentity.type = ENUMS.CUSTOMER_IDENTIFICATION_TYPES.DriversLicense;\r\n this.identifications.push(driverLicenseIdentity);\r\n }\r\n\r\n this.usingAddressExtra = this.address || this.zip || this.city || this.state || this.county ? !!this.addressExtra : null\r\n this.usingUSAddress = this.country != null ? (this.country == 'US') : null\r\n }\r\n\r\n getSanitizedData() {\r\n let sanitizedData = new FIMenuCustomer(this)\r\n sanitizedData.customerApplication = null\r\n sanitizedData.creditReport = null\r\n sanitizedData.creditPulls = null\r\n\r\n return sanitizedData\r\n }\r\n\r\n static validationTypes = {\r\n JUST_NAME: 'JUST_NAME',\r\n FINAL: 'FINAL',\r\n DEFAULT: 'DEFAULT',\r\n COCUSTOMER: 'COCUSTOMER',\r\n TRADEINOWNER: 'TRADEINOWNER',\r\n CUSTOMER_CREATION: 'CUSTOMER_CREATION'\r\n }\r\n\r\n getIdentification(type) {\r\n return this.identifications.find(i => i.type == type);\r\n }\r\n\r\n updateFullName() {\r\n if (!this.isEntity && this.firstName && this.lastName) {\r\n this.fullName = this.firstName.concat(' ').concat(this.lastName);\r\n }\r\n }\r\n\r\n //Takes CustomerClass\r\n setFromCustomer(customer) {\r\n this.id = customer.id || null;\r\n this.suffix = customer.generationSuffix\r\n this.fullName = customer.fullName\r\n this.firstName = customer.firstName\r\n this.lastName = customer.lastName\r\n this.middleName = customer.middleName\r\n this.isEntity = customer.isEntity || !customer.dateOfBirth\r\n this.plaidIDVOverride = customer.plaidIDVOverride\r\n this.idvOverride = customer.idvOverride\r\n this.statusIDV = customer.statusIDV\r\n this.isIDVSkipped = customer.isIDVSkipped\r\n this.language = customer.language;\r\n this.customerApplicationStatus = customer.customerApplicationStatus\r\n this.businessInfo = customer.businessInfo\r\n\r\n // Parse addresses\r\n if (customer.addresses && customer.addresses.length > 0) {\r\n const firstAddress = customer.addresses[customer.addresses.length - 1];\r\n\r\n this.usingAddressExtra = !!firstAddress.addressLine2\r\n this.usingUSAddress = firstAddress.country == \"US\"\r\n this.address = firstAddress.addressLine1 || null;\r\n this.addressExtra = firstAddress.addressLine2 || null;\r\n this.city = firstAddress.city || null;\r\n this.state = firstAddress.state || null;\r\n this.zip = firstAddress.zipCode || null;\r\n this.county = firstAddress.county || null;\r\n this.country = firstAddress.country || null;\r\n this.phone = firstAddress.homePhoneNumber || null;\r\n } else {\r\n this.usingAddressExtra = null\r\n this.usingUSAddress = null\r\n this.address = null;\r\n this.addressExtra = null;\r\n this.city = null;\r\n this.state = null;\r\n this.zip = null;\r\n this.county = null;\r\n this.country = null;\r\n this.phone = null;\r\n }\r\n this.prefix = customer.prefix\r\n\r\n this.email = customer.emailAddress\r\n this.cell = customer.phoneNumber\r\n this.creditReport = new FIMenuCreditReport(customer.creditReport); // You may need to adjust this based on the structure of your FIMenuCreditReport class\r\n this.creditPulls = customer?.creditPulls?.map(cp => new FIMenuCreditPulls(cp)) ?? []\r\n this.ssnLast4 = customer.ssnLast4\r\n this.ssnHashed = customer.ssnHashed\r\n this.identifications = (customer.identifications || []).map((identification) => new FIMenuCustomerIdentification(identification));\r\n this.customerApplication = customer.customerApplication\r\n this.metadata = new CustomerMetadata(customer.metadata)\r\n\r\n if (!this.identifications.some(i => i.type == ENUMS.CUSTOMER_IDENTIFICATION_TYPES.DriversLicense)) {\r\n let driverLicenseIdentity = new FIMenuCustomerIdentification();\r\n driverLicenseIdentity.type = ENUMS.CUSTOMER_IDENTIFICATION_TYPES.DriversLicense;\r\n this.identifications.push(driverLicenseIdentity);\r\n }\r\n\r\n if (customer.dateOfBirth) {\r\n this.dob = moment(customer.dateOfBirth, [\"YYYY-MM-DDTHH:mm:ss\", \"MM/DD/YYYY\"]).format(\"MM/DD/YYYY\")\r\n }\r\n }\r\n\r\n //Takes FIMenuCustomer\r\n setFromFIMenuCustomer(fimenuCustomer, storeCode = null) {\r\n this.id = fimenuCustomer.id || null;\r\n this.suffix = fimenuCustomer.suffix\r\n this.fullName = fimenuCustomer.fullName\r\n this.firstName = fimenuCustomer.firstName\r\n this.lastName = fimenuCustomer.lastName\r\n this.middleName = fimenuCustomer.middleName\r\n this.isEntity = fimenuCustomer.isEntity || !!fimenuCustomer.dob\r\n this.usingUSAddress = fimenuCustomer.country == \"US\";\r\n this.usingAddressExtra = !!fimenuCustomer.addressExtra\r\n this.address = fimenuCustomer.address;\r\n this.addressExtra = fimenuCustomer.addressExtra\r\n this.city = fimenuCustomer.city\r\n this.state = fimenuCustomer.state\r\n this.zip = fimenuCustomer.zip\r\n this.county = fimenuCustomer.county\r\n this.country = fimenuCustomer.country\r\n\r\n\r\n this.prefix = fimenuCustomer.prefix\r\n this.statusIDV = fimenuCustomer.statusIDV\r\n this.isIDVSkipped = fimenuCustomer.isIDVSkipped\r\n this.language = fimenuCustomer.language;\r\n this.customerApplicationStatus = fimenuCustomer.customerApplicationStatus\r\n this.metadata = new CustomerMetadata(fimenuCustomer.metadata)\r\n\r\n this.email = fimenuCustomer.email\r\n this.cell = fimenuCustomer.cell\r\n this.creditReport = new FIMenuCreditReport(fimenuCustomer.creditReport); // You may need to adjust this based on the structure of your FIMenuCreditReport class\r\n this.creditPulls = fimenuCustomer?.creditPulls?.map(cp => new FIMenuCreditPulls(cp)) ?? []\r\n this.ssnLast4 = fimenuCustomer.ssnLast4\r\n this.ssnHashed = fimenuCustomer.ssnHashed\r\n this.identifications = (fimenuCustomer.identifications || []).map((identification) => new FIMenuCustomerIdentification(identification));\r\n this.customerApplication = fimenuCustomer.customerApplication\r\n this.plaidIDVOverride = fimenuCustomer.plaidIDVOverride || null\r\n this.idvOverride = fimenuCustomer.idvOverride\r\n\r\n if (!this.identifications.some(i => i.type == ENUMS.CUSTOMER_IDENTIFICATION_TYPES.DriversLicense)) {\r\n let driverLicenseIdentity = new FIMenuCustomerIdentification();\r\n driverLicenseIdentity.type = ENUMS.CUSTOMER_IDENTIFICATION_TYPES.DriversLicense;\r\n this.identifications.push(driverLicenseIdentity);\r\n }\r\n\r\n if (fimenuCustomer.dob) {\r\n this.dob = moment(fimenuCustomer.dob, [\"YYYY-MM-DDTHH:mm:ss\", \"MM/DD/YYYY\"]).format(\"MM/DD/YYYY\")\r\n }\r\n }\r\n\r\n getFullName() {\r\n if (this.isEntity) {\r\n return this.fullName;\r\n }\r\n else if (this.firstName && this.lastName) {\r\n return this.firstName + ' ' + this.lastName;\r\n }\r\n else {\r\n return null;\r\n }\r\n }\r\n\r\n getFullAddress() {\r\n let fullAddress = \"\";\r\n\r\n // Concatenate address and addressExtra\r\n if (this.address) {\r\n fullAddress = this.address;\r\n\r\n if (this.addressExtra) {\r\n fullAddress += \", \" + this.addressExtra;\r\n }\r\n } else if (this.addressExtra) {\r\n fullAddress = this.addressExtra;\r\n }\r\n\r\n // Add city, county, and zip code\r\n if (this.city) {\r\n fullAddress += (fullAddress ? \", \" : \"\") + this.city;\r\n }\r\n\r\n if (this.state) {\r\n fullAddress += (fullAddress ? \", \" : \"\") + this.state;\r\n }\r\n\r\n // if (this.county) {\r\n // fullAddress += (fullAddress ? \", \" : \"\") + this.county;\r\n // }\r\n\r\n if (this.zip) {\r\n fullAddress += (fullAddress ? \", \" : \"\") + this.zip;\r\n }\r\n\r\n return fullAddress;\r\n }\r\n\r\n getAndSetCustomerApplication() {\r\n return api.applications.getByCustomer(this.id).then(response => {\r\n //console.log(response)\r\n if (response.data) {\r\n this.customerApplication = new Application(response.data);\r\n this.applicationId = this.customerApplication.id;\r\n }\r\n return response\r\n }).catch((error) => {\r\n console.error(\"Error loading customer application\", error);\r\n })\r\n }\r\n\r\n setCustomerApplication(customerId) {\r\n //console.log(\"ID###\", this.id)\r\n return api.applications.getByCustomer(customerId).then(response => {\r\n if (response.data) {\r\n this.customerApplication = new Application(response.data);\r\n this.applicationId = response.data.id\r\n }\r\n return response\r\n }).catch((error) => {\r\n console.error(\"Error loading customer application\", error);\r\n })\r\n }\r\n\r\n getAndSetCustomerApplicationByApplicationId(customerApplicationId, retriveIncomplete = false) {\r\n return api.applications.getApplication(customerApplicationId).then(response => {\r\n if (response.data) {\r\n this.customerApplication = new Application(response.data);\r\n }\r\n return response\r\n }).catch((error) => {\r\n console.error(\"Error loading customer application\", error);\r\n })\r\n }\r\n\r\n getAssociations() {\r\n let associations = [];\r\n\r\n if (this.id)\r\n associations.push(new DocumentAssociation({ type: ENUMS.DOC_ASSOCIATION.Customer, id: this.id }));\r\n if (this.applicationId)\r\n associations.push(new DocumentAssociation({ type: ENUMS.DOC_ASSOCIATION.CustomerApplication, id: this.applicationId }));\r\n\r\n return associations;\r\n }\r\n\r\n populateWithCustomerApplication(populateAsBusiness) {\r\n //this.isEntity = this.customerApplication.quoteAppData.applicationsDataAnswered.isBusiness\r\n this.language = this.customerApplication.language;\r\n\r\n if (populateAsBusiness) {\r\n this.isEntity = true\r\n this.fullName = this.customerApplication.quoteAppData.applicationsDataAnswered.businessInfo.legalName\r\n this.firstName = null\r\n this.middleName = null\r\n this.lastName = null\r\n this.suffix = null\r\n\r\n this.dob = this.customerApplication.quoteAppData.applicationsDataAnswered?.personalInfo?.dateOfBirth\r\n this.email = this.customerApplication.quoteAppData.applicationsDataAnswered.businessInfo.emailAddress\r\n this.cell = this.customerApplication.quoteAppData.applicationsDataAnswered.businessInfo.phoneNumber\r\n this.phone = null\r\n\r\n let address = this.customerApplication.quoteAppData.applicationsDataAnswered.businessInfo.address\r\n this.usingUSAddress = this.country != null ? (this.country == 'US') : null\r\n this.usingAddressExtra = !!address.addressLine2\r\n this.zip = address.zipCode\r\n this.address = address.addressLine1\r\n this.addressExtra = address.addressLine2\r\n this.city = address.city\r\n this.state = address.state\r\n this.county = address.county\r\n this.country = address.country\r\n\r\n this.ssnHashed = null\r\n this.ssnLast4 = null\r\n this.creditScore = null\r\n }\r\n else {\r\n //console.log(\"ENTERED populateWithCustomerApplication-nonBUSINESS\");\r\n this.isEntity = false\r\n\r\n let personalInfo = this.customerApplication.quoteAppData.applicationsDataAnswered.personalInfo\r\n this.prefix = personalInfo.prefix\r\n this.firstName = personalInfo.firstName\r\n this.middleName = personalInfo.middleName\r\n this.lastName = personalInfo.lastName\r\n this.suffix = personalInfo.generationSuffix\r\n\r\n this.dob = moment(personalInfo.dateOfBirth, \"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\").format(\"MM/DD/YYYY\")\r\n this.email = personalInfo.emailAddress\r\n this.cell = personalInfo.phoneNumber\r\n this.phone = personalInfo.currentResidence.homePhoneNumber\r\n\r\n let address = personalInfo.currentResidence\r\n this.usingUSAddress = this.country != null ? (this.country == 'US') : null\r\n this.usingAddressExtra = !!address.addressLine2\r\n this.zip = address.zipCode\r\n this.address = address.addressLine1\r\n this.addressExtra = address.addressLine2\r\n this.city = address.city\r\n this.state = address.state\r\n this.county = address.county\r\n this.country = address.country\r\n\r\n let customerAppDriverLicense = personalInfo.identifications?.find(i => i.type == ENUMS.CUSTOMER_IDENTIFICATION_TYPES.DriversLicense)\r\n\r\n if (customerAppDriverLicense) {\r\n\r\n let driverLicense = new FIMenuCustomerIdentification(customerAppDriverLicense)\r\n\r\n let index = this.identifications?.findIndex(i => i.type == ENUMS.CUSTOMER_IDENTIFICATION_TYPES.DriversLicense)\r\n\r\n if (driverLicense) {\r\n if (index >= 0) {\r\n this.identifications[index] = driverLicense\r\n }\r\n else {\r\n this.identifications.push(driverLicense)\r\n }\r\n }\r\n }\r\n\r\n this.ssnHashed = this.customerApplication.quoteAppData.applicationsDataAnswered.personalInfo.ssnHashed\r\n this.ssnLast4 = this.customerApplication.quoteAppData.applicationsDataAnswered.personalInfo.ssnLast4\r\n this.creditScore = null\r\n }\r\n\r\n this.customerApplicationStatus = this.customerApplication.customerApplicationStatus;\r\n }\r\n\r\n populateCustomerApplicationWithCustomer(populateAsBusiness) {\r\n //this.isEntity = this.customerApplication.quoteAppData.applicationsDataAnswered.isBusiness\r\n\r\n this.customerApplication.id = this.customerApplication.id ? this.customerApplication.id : util.getGuid()\r\n this.customerApplication.leadId = this.customerApplication.leadId ? this.customerApplication.leadId : util.getGuid()\r\n this.customerApplication.customerId = this.id ?? util.getGuid()\r\n this.customerApplication.dateCreated = this.customerApplication.dateCreated ? this.customerApplication.dateCreated : moment().utc()\r\n this.customerApplication.editLinkExpiration = this.customerApplication.editLinkExpiration ? moment(this.customerApplication.editLinkExpiration, \"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\") : moment().utc().format(\"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\")\r\n this.customerApplication.emailCodeExpiration = this.customerApplication.emailCodeExpiration ? moment(this.customerApplication.emailCodeExpiration, \"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\") : moment().utc().format(\"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\")\r\n this.customerApplication.phoneCodeExpiration = this.customerApplication.phoneCodeExpiration ? moment(this.customerApplication.phoneCodeExpiration, \"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\") : moment().utc().format(\"YYYY-MM-DDTHH:mm:ss.SSSSSSS[Z]\")\r\n\r\n\r\n if (populateAsBusiness) {\r\n this.customerApplication.quoteAppData.applicationsDataAnswered.isBusiness = this.isEntity ?? populateAsBusiness\r\n this.customerApplication.quoteAppData.applicationsDataAnswered.businessInfo.legalName = this.fullName\r\n\r\n // Applicant information.\r\n this.customerApplication.preFilledData.dateOfBirth = this.customerApplication.quoteAppData.applicationsDataAnswered.personalInfo.dateOfBirth ?? this.dob\r\n this.customerApplication.preFilledData.emailAddress = this.customerApplication.quoteAppData.applicationsDataAnswered.personalInfo.emailAddress ?? this.email\r\n this.customerApplication.preFilledData.firstName = this.firstName\r\n this.customerApplication.preFilledData.lastName = this.lastName\r\n this.customerApplication.preFilledData.phoneNumber = this.customerApplication.quoteAppData.applicationsDataAnswered.personalInfo.phoneNumber ?? this.cell\r\n\r\n this.customerApplication.quoteAppData.applicationsDataAnswered.businessInfo.emailAddress = this.email\r\n this.customerApplication.quoteAppData.applicationsDataAnswered.businessInfo.phoneNumber = this.cell\r\n this.customerApplication.quoteAppData.applicationsDataAnswered.businessInfo.address.addressLine2 = this.addressExtra\r\n this.customerApplication.quoteAppData.applicationsDataAnswered.businessInfo.address.addressLine1 = this.address\r\n this.customerApplication.quoteAppData.applicationsDataAnswered.businessInfo.address.zipCode = this.zip\r\n this.customerApplication.quoteAppData.applicationsDataAnswered.businessInfo.address.city = this.city\r\n this.customerApplication.quoteAppData.applicationsDataAnswered.businessInfo.address.state = this.state\r\n this.customerApplication.quoteAppData.applicationsDataAnswered.businessInfo.address.county = this.county\r\n this.customerApplication.quoteAppData.applicationsDataAnswered.businessInfo.address.country = this.country\r\n\r\n }\r\n else {\r\n this.customerApplication.quoteAppData.applicationsDataAnswered.isBusiness = this.isEntity\r\n this.customerApplication.quoteAppData.applicationsDataAnswered.personalInfo.prefix = this.prefix\r\n this.customerApplication.quoteAppData.applicationsDataAnswered.personalInfo.firstName = this.firstName\r\n this.customerApplication.quoteAppData.applicationsDataAnswered.personalInfo.middleName = this.middleName\r\n this.customerApplication.quoteAppData.applicationsDataAnswered.personalInfo.lastName = this.lastName\r\n this.customerApplication.quoteAppData.applicationsDataAnswered.personalInfo.generationSuffix = this.suffix\r\n\r\n this.customerApplication.preFilledData.dateOfBirth = this.dob\r\n this.customerApplication.preFilledData.emailAddress = this.email\r\n this.customerApplication.preFilledData.firstName = this.firstName\r\n this.customerApplication.preFilledData.lastName = this.lastName\r\n this.customerApplication.preFilledData.phoneNumber = this.phone\r\n\r\n this.customerApplication.quoteAppData.applicationsDataAnswered.personalInfo.dateOfBirth = this.dob\r\n this.customerApplication.quoteAppData.applicationsDataAnswered.personalInfo.emailAddress = this.email\r\n this.customerApplication.quoteAppData.applicationsDataAnswered.personalInfo.phoneNumber = this.cell\r\n this.customerApplication.quoteAppData.applicationsDataAnswered.personalInfo.currentResidence.homePhoneNumber = this.phone\r\n this.customerApplication.quoteAppData.applicationsDataAnswered.personalInfo.currentResidence.zipCode = this.zip\r\n\r\n this.customerApplication.quoteAppData.applicationsDataAnswered.personalInfo.currentResidence.addressLine1 = this.address\r\n this.customerApplication.quoteAppData.applicationsDataAnswered.personalInfo.currentResidence.addressLine2 = this.addressExtra\r\n this.customerApplication.quoteAppData.applicationsDataAnswered.personalInfo.currentResidence.city = this.city\r\n this.customerApplication.quoteAppData.applicationsDataAnswered.personalInfo.currentResidence.state = this.state\r\n this.customerApplication.quoteAppData.applicationsDataAnswered.personalInfo.currentResidence.county = this.county\r\n this.customerApplication.quoteAppData.applicationsDataAnswered.personalInfo.currentResidence.country = this.country\r\n\r\n this.customerApplication.quoteAppData.applicationsDataAnswered.personalInfo.identifications = this.identifications;\r\n this.customerApplication.quoteAppData.applicationsDataAnswered.personalInfo.ssnHashed = this.ssnHashed;\r\n\r\n this.customerApplication.quoteAppData.applicationsDataAnswered.personalInfo.ssnLast4 = this.ssnLast4;\r\n }\r\n }\r\n\r\n populateWithApplicant(applicantInfo) {\r\n this.firstName = applicantInfo.firstName\r\n this.lastName = applicantInfo.lastName\r\n this.middleName = applicantInfo.middleName\r\n this.email = applicantInfo.emailAddress\r\n this.ssnLast4 = applicantInfo.ssnLast4\r\n this.usingUSAddress = applicantInfo.currentResidence.country != null ? (applicantInfo.currentResidence.country == 'US') : null\r\n this.usingAddressExtra = applicantInfo.currentResidence.addressLine2 != null ? true : false\r\n this.address = applicantInfo.currentResidence.addressLine1\r\n this.addressExtra = applicantInfo.currentResidence.addressLine2\r\n this.city = applicantInfo.currentResidence.city\r\n this.county = applicantInfo.currentResidence.county\r\n this.zip = applicantInfo.currentResidence.zipCode\r\n this.state = applicantInfo.currentResidence.state\r\n this.country = applicantInfo.currentResidence.country\r\n this.dob = applicantInfo.dateOfBirth\r\n this.suffix = applicantInfo.generationSuffix\r\n this.prefix = applicantInfo.prefix\r\n this.cell = applicantInfo.phoneNumber\r\n this.phone = applicantInfo.currentResidence.homePhoneNumber\r\n }\r\n\r\n isITIN() {\r\n if (this.customerApplication && this.customerApplication.quoteAppData.applicationsDataAnswered.personalInfo.ssnHashed) {\r\n return this.customerApplication.quoteAppData.applicationsDataAnswered.personalInfo.ssnType == ENUMS.SSN_TYPES.ITIN\r\n }\r\n return false\r\n }\r\n\r\n validation(fimenu, type = FIMenuCustomer.validationTypes.DEFAULT) {\r\n //const customerApplicationDisabled = fimenu?.customerApplication == ENUMS.CUSTOMER_RETRIEVAL_STATUS.RetrieveApplicationEnabled\r\n const customerHasAccessToFIManager = auth.hasAccessToPermission(\"FIManager\");\r\n\r\n let driversLicenseValidation = (identification) => ({\r\n idNumber: {\r\n //required: requiredIf(!this.isEntity && identification.type == ENUMS.CUSTOMER_IDENTIFICATION_TYPES.DriversLicense && !!fimenu?.buyersOrderEnabled && customerHasAccessToFIManager)\r\n },\r\n expirationDate: {\r\n //required: requiredIf(() => !this.isEntity && identification.type == ENUMS.CUSTOMER_IDENTIFICATION_TYPES.DriversLicense && !!fimenu?.buyersOrderEnabled && customerHasAccessToFIManager),\r\n validDate: (value, i) => {\r\n if (!this.isEntity && i.type == ENUMS.CUSTOMER_IDENTIFICATION_TYPES.DriversLicense && !!fimenu?.buyersOrderEnabled && customerHasAccessToFIManager)\r\n return validDate(value);\r\n else\r\n return true;\r\n },\r\n validDriversLicenseExpirationDate: (value, i) => {\r\n if (!this.isEntity && i.type == ENUMS.CUSTOMER_IDENTIFICATION_TYPES.DriversLicense && !!fimenu?.buyersOrderEnabled && customerHasAccessToFIManager)\r\n return validDriversLicenseExpirationDate(value);\r\n else\r\n return true;\r\n }\r\n },\r\n jurisdiction: {\r\n //required: requiredIf(!this.isEntity && identification.type == ENUMS.CUSTOMER_IDENTIFICATION_TYPES.DriversLicense && !!fimenu?.buyersOrderEnabled && customerHasAccessToFIManager)\r\n }\r\n });\r\n\r\n let data = {\r\n number: {},\r\n isEntity: {},\r\n prefix: {},\r\n fullName: {},\r\n firstName: {},\r\n middleName: {},\r\n lastName: {},\r\n suffix: {},\r\n address: {},\r\n addressExtra: {},\r\n city: {},\r\n state: {},\r\n zip: {},\r\n phone: {},\r\n email: {},\r\n signature: {},\r\n cell: {},\r\n workPhone: {},\r\n county: {},\r\n country: {},\r\n dob: {},\r\n creditScore: { between: between(300, 850) },\r\n ssnLast4: {},\r\n ssnHashed: {},\r\n isCitizen: {},\r\n isSalesTaxExempt: {},\r\n creditReport: {\r\n flags: {},\r\n },\r\n customerApplication: {\r\n quoteAppData: {\r\n applicationsDataAnswered: {\r\n businessInfo: {\r\n tradeName: {},\r\n enterpriseType: {},\r\n businessStartDate: {},\r\n grossMontlyProfit: {},\r\n businessOperator: {\r\n operatorSameAsApplicant: {},\r\n firstName: {},\r\n lastName: {},\r\n relationshipDescription: {},\r\n address: {}\r\n },\r\n businessPrincipal: {\r\n principalSameAsApplicant: {},\r\n firstName: {},\r\n lastName: {},\r\n jobTitle: {},\r\n address: {},\r\n phoneNumber: {},\r\n dateOfBirth: {},\r\n percentageOfOwnership: {},\r\n }\r\n }\r\n }\r\n },\r\n id: {},\r\n status: {}\r\n }\r\n }\r\n\r\n const applicationsDataAnswered = this.customerApplication?.quoteAppData.applicationsDataAnswered;\r\n\r\n const requiredIfMeetsResubmitCondition = (redFlag) => {\r\n let exists = redFlag.commentAlreadyExists == true;\r\n let empty = redFlag.comment == null;\r\n return exists == true && empty == true;\r\n };\r\n\r\n const minWordsToPass = (value, targetWords) => {\r\n const words = (value.trim()).split(' ')\r\n return words.length >= targetWords;\r\n };\r\n\r\n switch (type) {\r\n case FIMenuCustomer.validationTypes.DEFAULT:\r\n\r\n data.fullName = {\r\n required: requiredIf(() => this.isEntity),\r\n maxLengthLength: this.isEntity ? maxLength(60) : maxLength(120),\r\n };\r\n data.prefix = {\r\n required: requiredIf(() => !this.isEntity)\r\n }\r\n data.firstName = {\r\n required: requiredIf(() => !this.isEntity),\r\n valid: validName\r\n };\r\n data.middleName = {\r\n valid: validName\r\n };\r\n data.lastName = {\r\n required: requiredIf(() => !this.isEntity),\r\n valid: validName\r\n };\r\n data.dob = {\r\n required: requiredIf(() => !this.isEntity),\r\n validDateOfBirth\r\n };\r\n data.isCitizen = {\r\n //temporarily remove validation\r\n /*required: requiredIf(c => !c.isEntity),*/\r\n };\r\n data.ssnLast4 = {\r\n validSSN: (value, customer) => {\r\n\r\n if (value && customer.ssnHashed !== null) return true;\r\n\r\n if (customer.ssnHashed === null)\r\n return validSSN(value);\r\n else\r\n return true;\r\n }\r\n };\r\n data.ssnHashed = {\r\n // isSSNUsed: (ssnHashed, c) => {\r\n // if (this.isEntity) {\r\n // return true;\r\n // }\r\n // return isSSNUsed(ssnHashed, fimenu);\r\n // }\r\n };\r\n\r\n\r\n\r\n data.address = { required }\r\n data.addressExtra = { required: requiredIf(() => this.usingAddressExtra) };\r\n data.city = { required }\r\n data.state = {\r\n required,\r\n minLength: this.usingUSAddress == false ? {} : minLength(2),\r\n maxLength: this.usingUSAddress == false ? {} : maxLength(2)\r\n }\r\n data.county = { required: requiredIf(() => this.usingUSAddress) }\r\n data.country = { required }\r\n data.zip = {\r\n required,\r\n validZIPUS: () => {\r\n if (this.usingUSAddress != false) {\r\n return validZIPUS(this.zip);\r\n }\r\n return true;\r\n },\r\n validZIPInternational: () => {\r\n if (this.usingUSAddress == false) {\r\n return validZIPInternational(this.zip);\r\n }\r\n return true;\r\n }\r\n }\r\n data.email = { required, email }\r\n data.phone = { minLength: minLength(10), maxLength: maxLength(10) }\r\n data.cell = { required, minLength: minLength(10), maxLength: maxLength(10) }\r\n data.workPhone = { minLength: minLength(10), maxLength: maxLength(10) }\r\n data.identifications = this.identifications.map((identification) => (driversLicenseValidation(identification)));\r\n //data.isSalesTaxExempt = { required: requiredIf(() => this.isEntity) };\r\n data.id = { required }\r\n data.isThereAnyUnsavedCustomerChanges = {\r\n isValid: () => !this.isThereAnyUnsavedCustomerChanges\r\n }\r\n data.creditReport.flags = this.creditReport.flags.map(flag => ({\r\n redflags: flag.redflags.map(redFlag => ({\r\n comment: {\r\n required,\r\n minLength: requiredIf(() => redFlag.comment) && minLength(11),\r\n minWords: () => redFlag.comment ? minWordsToPass(redFlag.comment, 3) : true\r\n }\r\n }))\r\n }))\r\n\r\n data.statusIDV = {\r\n required: requiredIf(() => !this.isEntity && IDVHelper.isIDVEnabled(fimenu?.store) && !this.isIDVSkipped),\r\n isValid: () => {\r\n return this.isEntity\r\n || !IDVHelper.isIDVEnabled(fimenu?.store)\r\n || this.isIDVSkipped\r\n || this.statusIDV === ENUMS.PLAID_VERIFICATION_STATUS.Success.ind;\r\n }\r\n }\r\n\r\n data.customerApplication.id = { \r\n required: requiredIf(\r\n () => !this.isEntity && fimenu.customerApplication === ENUMS.CUSTOMER_RETRIEVAL_STATUS.RetrieveApplicationEnabled\r\n )\r\n }\r\n data.customerApplication.status = {\r\n required: requiredIf(() => !this.isEntity && fimenu.customerApplication === ENUMS.CUSTOMER_RETRIEVAL_STATUS.RetrieveApplicationEnabled),\r\n isValid: (currentStatus) => {\r\n if(this.isEntity) return true;\r\n const isCustomerApplicationEnabled = fimenu.customerApplication === ENUMS.CUSTOMER_RETRIEVAL_STATUS.RetrieveApplicationEnabled;\r\n if (!isCustomerApplicationEnabled) return true;\r\n\r\n const custAppStatuses = ENUMS.CUSTOMER_APPLICATION_STATUS;\r\n const completed = currentStatus == custAppStatuses.Completed || currentStatus == custAppStatuses.CompletedNoCredit;\r\n\r\n return completed;\r\n }\r\n }\r\n // dateCompleted: {\r\n // required: requiredIf(() => fimenu.customerApplication === ENUMS.CUSTOMER_RETRIEVAL_STATUS.RetrieveApplicationEnabled),\r\n // isValid: (dateCompleted) => {\r\n\r\n // const isCustomerApplicationEnabled = fimenu.customerApplication === ENUMS.CUSTOMER_RETRIEVAL_STATUS.RetrieveApplicationEnabled;\r\n // if (!isCustomerApplicationEnabled) return true;\r\n\r\n // if (dateCompleted) {\r\n // const daysCount = moment().diff(dateCompleted, 'days')\r\n // return daysCount >= settings.lookups.customerApplicationExpiration == true ? false : true\r\n // }\r\n // return true\r\n // }\r\n // }\r\n\r\n\r\n\r\n return data;\r\n\r\n case FIMenuCustomer.validationTypes.COCUSTOMER:\r\n\r\n if (fimenu.hasCoSigner) {\r\n data.fullName = {\r\n required: requiredIf(() => this.isEntity),\r\n maxLengthLength: this.isEntity ? maxLength(60) : maxLength(120),\r\n };\r\n data.prefix = { required: requiredIf(() => !this.isEntity) };\r\n data.isCitizen = {\r\n //temoprarily remove validation\r\n //required: requiredIf(() => this.isEntity)\r\n };\r\n data.firstName = {\r\n maxLengthLength: maxLength(60),\r\n required: requiredIf(() => !this.isEntity),\r\n valid: validName\r\n };\r\n data.middleName = {\r\n maxLengthLength: maxLength(60),\r\n valid: validName\r\n };\r\n data.lastName = {\r\n maxLengthLength: maxLength(60),\r\n required: requiredIf(() => !this.isEntity),\r\n valid: validName\r\n };\r\n data.dob = {\r\n required: requiredIf(() => !this.isEntity),\r\n validDateOfBirth\r\n };\r\n data.ssnLast4 = {\r\n validSSN: (value, customer) => {\r\n\r\n if (value && customer.ssnHashed !== null) return true;\r\n\r\n if (customer.ssnHashed === null)\r\n return validSSN(value);\r\n else\r\n return true;\r\n }\r\n };\r\n data.ssnHashed = {\r\n // isSSNUsed: (ssnHashed, c) => {\r\n // if (c.isEntity) {\r\n // return true;\r\n // }\r\n // return isSSNUsed(ssnHashed, fimenu);\r\n // }\r\n };\r\n\r\n data.address = { required }\r\n data.addressExtra = { required: requiredIf(this.usingAddressExtra) };\r\n data.city = { required }\r\n data.state = {\r\n required,\r\n minLength: this.usingUSAddress == false ? {} : minLength(2),\r\n maxLength: this.usingUSAddress == false ? {} : maxLength(2)\r\n }\r\n data.county = { required: requiredIf(() => this.usingUSAddress) }\r\n data.zip = {\r\n required,\r\n validZIPUS: () => {\r\n if (this.usingUSAddress != false) {\r\n return validZIPUS(this.zip);\r\n }\r\n return true;\r\n },\r\n validZIPInternational: () => {\r\n if (this.usingUSAddress == false) {\r\n return validZIPInternational(this.zip);\r\n }\r\n return true;\r\n }\r\n }\r\n data.email = { required, email }\r\n data.phone = { minLength: minLength(10), maxLength: maxLength(10) }\r\n data.cell = { required, minLength: minLength(10), maxLength: maxLength(10) }\r\n data.workPhone = { minLength: minLength(10), maxLength: maxLength(10) }\r\n data.identifications = this.identifications.map((identification) => (driversLicenseValidation(identification)))\r\n data.isSalesTaxExempt = { required: requiredIf(() => this.isEntity) };\r\n data.id = { required }\r\n data.isThereAnyUnsavedCustomerChanges = {\r\n isValid: () => !this.isThereAnyUnsavedCustomerChanges\r\n }\r\n\r\n data.statusIDV = {\r\n required: requiredIf(() => !this.isEntity && IDVHelper.isIDVEnabled(fimenu?.store) && !this.isIDVSkipped ),\r\n isValid: () => {\r\n return this.isEntity\r\n || !IDVHelper.isIDVEnabled(fimenu?.store)\r\n || this.isIDVSkipped\r\n || this.statusIDV === ENUMS.PLAID_VERIFICATION_STATUS.Success.ind;\r\n }\r\n }\r\n data.creditReport.flags = this.creditReport.flags.map(flag => ({\r\n redflags: flag.redflags.map((redFlag) => ({\r\n comment: {\r\n required,\r\n minLength: requiredIf(() => redFlag.comment) && minLength(11),\r\n minWords: () => redFlag.comment ? minWordsToPass(redFlag.comment, 3) : true,\r\n }\r\n }))\r\n }))\r\n\r\n data.customerApplication = {\r\n id: { required: requiredIf(() => fimenu.hasCoSigner && fimenu.customerApplication === ENUMS.CUSTOMER_RETRIEVAL_STATUS.RetrieveApplicationEnabled) },\r\n status: {\r\n isValid: (currentStatus) => {\r\n const isCustomerApplicationEnabled = fimenu.customerApplication === ENUMS.CUSTOMER_RETRIEVAL_STATUS.RetrieveApplicationEnabled;\r\n if (!isCustomerApplicationEnabled) return true;\r\n\r\n const custAppStatuses = ENUMS.CUSTOMER_APPLICATION_STATUS;\r\n const completed = currentStatus == custAppStatuses.Completed || currentStatus == custAppStatuses.CompletedNoCredit;\r\n\r\n return completed;\r\n }\r\n },\r\n // dateCompleted: {\r\n // required: requiredIf(() => fimenu.customerApplication === ENUMS.CUSTOMER_RETRIEVAL_STATUS.RetrieveApplicationEnabled),\r\n // isValid: (dateCompleted) => {\r\n\r\n // const isCustomerApplicationEnabled = fimenu.customerApplication === ENUMS.CUSTOMER_RETRIEVAL_STATUS.RetrieveApplicationEnabled;\r\n // if (!isCustomerApplicationEnabled) return true;\r\n\r\n // if (dateCompleted) {\r\n // const daysCount = moment().diff(dateCompleted, 'days')\r\n // return daysCount >= settings.lookups.customerApplicationExpiration == true ? false : true\r\n // }\r\n // return true\r\n // }\r\n // }\r\n }\r\n }\r\n\r\n return data;\r\n case FIMenuCustomer.validationTypes.JUST_NAME:\r\n\r\n data.fullName = { required: requiredIf(() => this.isEntity) };\r\n data.firstName = { required: requiredIf(() => !this.isEntity) };\r\n data.lastName = { required: requiredIf(() => !this.isEntity) };\r\n data.ssnLast4 = {\r\n validSSN: (value, customer) => {\r\n\r\n if (value && customer.ssnHashed !== null) return true;\r\n\r\n if (customer.ssnHashed === null)\r\n return validSSN(value);\r\n else\r\n return true;\r\n }\r\n };\r\n data.ssnHashed = {\r\n // isSSNUsed: (ssnHashed, c) => {\r\n // if (c.isEntity) {\r\n // return true;\r\n // }\r\n // return isSSNUsed(ssnHashed, fimenu);\r\n // }\r\n };\r\n\r\n\r\n return data\r\n\r\n case FIMenuCustomer.validationTypes.CUSTOMER_CREATION:\r\n\r\n data.prefix = { required: requiredIf(() => !this.isEntity) };\r\n data.fullName = {\r\n required: requiredIf(() => this.isEntity),\r\n maxLengthLength: this.isEntity ? maxLength(60) : maxLength(120),\r\n };\r\n data.firstName = {\r\n required: requiredIf(() => !this.isEntity),\r\n valid: validName\r\n };\r\n data.middleName = {\r\n valid: validName\r\n };\r\n data.lastName = {\r\n required: requiredIf(() => !this.isEntity),\r\n valid: validName\r\n };\r\n data.dob = {\r\n required: requiredIf(() => !this.isEntity),\r\n validDateOfBirth\r\n };\r\n data.email = { required, email }\r\n data.cell = { required, numeric, minLength: minLength(10), maxLength: maxLength(10) }\r\n data.identifications = this.identifications.map((identification) => (driversLicenseValidation(identification)))\r\n data.ssnLast4 = {\r\n validSSN: (value, customer) => {\r\n\r\n if (value && customer.ssnHashed !== null) return true;\r\n\r\n if (customer.ssnHashed === null)\r\n return validSSN(value);\r\n else\r\n return true;\r\n }\r\n };\r\n data.ssnHashed = {\r\n required: requiredIf(() => this.ssnLast4)\r\n };\r\n\r\n data.address = { required }\r\n data.addressExtra = { required: requiredIf(() => this.usingAddressExtra) };\r\n data.city = { required }\r\n data.state = {\r\n required,\r\n minLength: this.usingUSAddress == false ? {} : minLength(2),\r\n maxLength: this.usingUSAddress == false ? {} : maxLength(2)\r\n }\r\n data.county = { required: requiredIf(() => this.usingUSAddress) }\r\n data.zip = {\r\n required,\r\n validZIPUS: () => {\r\n if (this.usingUSAddress != false) {\r\n return validZIPUS(this.zip);\r\n }\r\n return true;\r\n },\r\n validZIPInternational: () => {\r\n if (this.usingUSAddress == false) {\r\n return validZIPInternational(this.zip);\r\n }\r\n return true;\r\n }\r\n }\r\n data.creditReport.flags = this.creditReport.flags.map(flag => ({\r\n redflags: flag.redflags.map((redFlag) => ({\r\n comment: {\r\n required,\r\n minLength: requiredIf(() => redFlag.comment) && minLength(11),\r\n minWords: () => redFlag.comment ? minWordsToPass(redFlag.comment, 3) : true\r\n }\r\n }))\r\n }))\r\n return data\r\n\r\n case FIMenuCustomer.validationTypes.FINAL:\r\n data.address = { required }\r\n data.city = { required }\r\n data.county = { required: requiredIf(() => this.usingUSAddress) }\r\n data.zip = {\r\n required,\r\n validZIPUS: () => {\r\n if (this.usingUSAddress != false) {\r\n return validZIPUS(this.zip);\r\n }\r\n return true;\r\n },\r\n validZIPInternational: () => {\r\n if (this.usingUSAddress == false) {\r\n return validZIPInternational(this.zip);\r\n }\r\n return true;\r\n }\r\n }\r\n data.state = {\r\n required,\r\n minLength: this.usingUSAddress == false ? {} : minLength(2),\r\n maxLength: this.usingUSAddress == false ? {} : maxLength(2)\r\n }\r\n data.email = { required, email }\r\n data.phone = { numeric, minLength: minLength(10), maxLength: maxLength(10) }\r\n data.cell = { required, numeric, minLength: minLength(10), maxLength: maxLength(10) }\r\n data.address = { required }\r\n data.addressExtra = { required: requiredIf(() => this.usingAddressExtra) }\r\n\r\n\r\n return data;\r\n\r\n\r\n\r\n case FIMenuCustomer.validationTypes.TRADEINOWNER:\r\n\r\n data.id = { required };\r\n // data.fullName = { required: requiredIf(() => this.isEntity) };\r\n // data.prefix = { required: requiredIf(() => !this.isEntity) };\r\n // data.isCitizen = {\r\n // //temporarily remove validation\r\n // //required: requiredIf(() => this.isEntity)\r\n // };\r\n // data.firstName = { required: requiredIf(() => !this.isEntity) };\r\n data.middleName = { valid: validName };\r\n // data.lastName = { required: requiredIf(() => !this.isEntity) };\r\n // data.dob = {\r\n // required: requiredIf(() => !this.isEntity) ,\r\n // validDateOfBirth\r\n // };\r\n // data.ssnLast4 = {\r\n // validSSN: (value, customer) => {\r\n\r\n // if (value && customer.ssnHashed !== null) return true;\r\n\r\n // if (customer.ssnHashed === null)\r\n // return validSSN(value);\r\n // else\r\n // return true;\r\n // }\r\n // };\r\n // data.ssnHashed = { required: requiredIf( () => !this.isEntity && fimenu.dealType !== \"Cash\") }\r\n // data.address = { required }\r\n // data.addressExtra = { required: requiredIf(() => this.usingAddressExtra) }\r\n // data.city = { required }\r\n //data.state = {\r\n // required,\r\n // minLength: this.usingUSAddress != false ?? minLength(2),\r\n // maxLength: this.usingUSAddress != false ?? maxLength(2)\r\n //}\r\n // data.county = { required: requiredIf(() => this.usingUSAddress) }\r\n //data.zip = {\r\n // required,\r\n // validZIPUS: () => {\r\n // if (this.usingUSAddress != false) {\r\n // return validZIPUS(this.zip);\r\n // }\r\n // return true;\r\n // },\r\n // validZIPInternational: () => {\r\n // if (this.usingUSAddress == false) {\r\n // return validZIPInternational(this.zip);\r\n // }\r\n // return true;\r\n //}\r\n //}\r\n // data.email = { required, email }\r\n // data.phone = { minLength: minLength(10), maxLength: maxLength(10) }\r\n // data.cell = { required, minLength: minLength(10), maxLength: maxLength(10) }\r\n // data.workPhone = { minLength: minLength(10), maxLength: maxLength(10) }\r\n\r\n return data\r\n default:\r\n return data\r\n }\r\n }\r\n\r\n /**\r\n * @returns if there is an error from CBC api regarding this customer, return true\r\n */\r\n hasCBCError() {\r\n return (\r\n this.creditReport && this.creditReport?.response?.error == \"True\"\r\n );\r\n }\r\n\r\n /**\r\n * @returns CBC error message if true, else return false\r\n */\r\n cbcErrorResponse() {\r\n const thereIsAnErrorResponse =\r\n this?.creditReport?.response?.erroR_DESCRIPT;\r\n const theErrorMessageIsEmpty =\r\n this?.creditReport?.response?.erroR_DESCRIPT == \"\";\r\n if (thereIsAnErrorResponse && !theErrorMessageIsEmpty) {\r\n return this.creditReport.response.erroR_DESCRIPT;\r\n } else return false;\r\n }\r\n\r\n getCustomerAssociation() {\r\n new DocumentAssociation({ id: this.id, type: ENUMS.DOC_ASSOCIATION.Customer });\r\n }\r\n\r\n /**\r\n * Gets the newest IDV Session ID found in our ElasticSearch index.\r\n * @return {string} The newest IDV Session ID, if found.\r\n * @memberof FIMenuCustomer\r\n */\r\n async getIDVSessionID() {\r\n try {\r\n const response = await api.plaid.getMostRecentIDVSessionID(this.id, ENUMS.DOC_ASSOCIATION.Customer);\r\n return response?.data;\r\n }\r\n catch (err) {\r\n console.error(err);\r\n return null;\r\n }\r\n }\r\n\r\n /**\r\n * Gets the IDV session Information from Plaid.\r\n * @param {boolean} [updateCustomer=false] Whether we should update the customer\r\n * @param {*} [sessionId=null] The session ID of the IDV Session. If nothing is passed in, defaults to the most recent session.\r\n * @return {Object} The IDV session data.\r\n * @memberof FIMenuCustomer\r\n */\r\n async getIDVSession(updateCustomer = false, sessionId = null) {\r\n try {\r\n // If no session ID is specified, try to grab the latest session ID.\r\n if (!sessionId) {\r\n sessionId = await this.getIDVSessionID(this.id);\r\n if (!sessionId) return null;\r\n }\r\n\r\n let response = await api.plaid.getIdentityVerification(sessionId);\r\n if (!response?.data)\r\n throw new Error('Error Fetching IDV Session Data', { cause: 'NO RESONSE FROM SERVER' });\r\n\r\n const plaidResponse = response.data.plaidResponse;\r\n if (updateCustomer && plaidResponse) {\r\n // If we get a sucessful session, the session is no longer considered \"skipped\"\r\n if (plaidResponse.status === ENUMS.PLAID_VERIFICATION_STATUS.Success.str)\r\n this.isIDVSkipped = false;\r\n\r\n this.statusIDV = ENUMS.PLAID_VERIFICATION_STATUS.stringToIndex(plaidResponse.status);\r\n }\r\n\r\n return response.data;\r\n }\r\n catch (err) {\r\n console.error(err)\r\n return null;\r\n }\r\n }\r\n\r\n /**\r\n * Gets the most recent IDV session and only returns the current status.\r\n * @param {boolean} [updateCustomer=false] Whether to update the customer record with the new IDV information.\r\n * @return {string} The status of the newest IDV session as a string enum.\r\n * @memberof FIMenuCustomer\r\n */\r\n async getIDVStatus(updateCustomer = false) {\r\n const idvSession = await this.getIDVSession(updateCustomer);\r\n return idvSession?.plaidResponse?.status;\r\n }\r\n\r\n /**\r\n * Fetches the current IDV status and updates this.statusIDV with the new value.\r\n * @return {boolean} Whether the IDVStatus has been successfully updated.\r\n * @memberof FIMenuCustomer\r\n */\r\n async refreshIDVStatus() {\r\n const sessionStatus = await this.getIDVStatus();\r\n if (!sessionStatus?.plaidResponse) return false;\r\n\r\n this.statusIDV = sessionStatus.plaidResponse.status;\r\n return true;\r\n }\r\n\r\n /**\r\n * @method save the customer; if it matches another customer; it'll update the customer.\r\n * @param {string} storeCode The storecode the customer is being saved from. IF ANY.\r\n * @param {boolean} savedFromFIMenuDeal Wether this customer was seved from a deal or customers page.\r\n */\r\n async save(storeCode = null, savedFromFIMenuDeal = true, dealDate = null) {\r\n if (this.isEntity) this.dob = null;\r\n // We save the customer. The server will choose to either create it or change it.\r\n const response = await api.customers.createCustomerFromFIMenu(\r\n this,\r\n storeCode,\r\n savedFromFIMenuDeal ? ENUMS.CUSTOMER_CREATION_SOURCE.FIMenuDeal : ENUMS.CUSTOMER_CREATION_SOURCE.CustomersPage,\r\n dealDate\r\n )\r\n\r\n // IF customer changed, it'll repopulate itself into the new customer.\r\n if (response?.data?.id != null && response?.data?.id != this.id) {\r\n this.id = response.data.id\r\n this.setFromCustomer(response.data)\r\n this.loadCustomerData(response.data.id)\r\n\r\n LogRocket.track(`Cust_Created`, {\r\n customerId: this.id,\r\n customerCell: this.cell,\r\n customerEmail: this.email,\r\n customerDob: this.dob,\r\n storeCode: storeCode,\r\n environment: settings.environmentName,\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * This will fetch the customer and populate itself again.\r\n *\r\n * @param {boolean} [loadCreditReport=true]\r\n * @memberof FIMenuCustomer\r\n */\r\n async reload(loadCreditReport = true) {\r\n try {\r\n if (this.isEntity) this.dob = null;\r\n // We save the customer. The server will choose to either create it or change it.\r\n const response = await api.customers.getCustomerById(this.id);\r\n\r\n // IF customer changed, it'll repopulate itself into the new customer.\r\n if (response?.data) {\r\n this.setFromCustomer(response.data)\r\n if (loadCreditReport) await this.loadCustomerData(response.data.id)\r\n }\r\n } catch (err) {\r\n console.error(\"Error loading customer: \", err)\r\n\r\n }\r\n }\r\n\r\n async getCreditReport(dealId = null) {\r\n // Initialize response variable\r\n\r\n try {\r\n // Fetch credit report for a customer.\r\n const response = await api.creditreport.getByCustomerId(this.id, dealId)\r\n return new FIMenuCreditReport(response.data)\r\n\r\n } catch (error) {\r\n // Log any errors that occur during the process\r\n console.error('Error fetching credit report:', error)\r\n }\r\n\r\n return null;\r\n\r\n }\r\n\r\n /** Get the associated business customers if its a human customer. If its a business, get associated humans */\r\n async getAndSetAssociatedCustomers (isEntity) {\r\n try {\r\n let response; \r\n if (isEntity) {\r\n response = await api.customers.getAssociatedCustomersForBusiness(this.id) \r\n } else {\r\n response = await api.customers.getAssociatedBusinessesForCustomer(this.id) \r\n }\r\n\r\n if(response?.data?.statusCode == 200) {\r\n const customerRecordCustomers = response.data.payload;\r\n this.associatedCustomers = customerRecordCustomers.map((init) => {\r\n var brandNewCustomer = new FIMenuCustomer()\r\n brandNewCustomer.setFromCustomer(init)\r\n return brandNewCustomer;\r\n }) \r\n }\r\n\r\n if(response?.data.statusCode == 204) {\r\n LogRocket.log('No associated customers.')\r\n return; \r\n }\r\n } catch (error) {\r\n console.error(\"Error fetching associated customers.\", error)\r\n }\r\n }\r\n\r\n //TODO: Rename to get and set.\r\n async getCreditPullsForCustomer() {\r\n let response = await CBCHelper.getCBCReportByCustomerId(this.id)\r\n const creditPullsData = response.data || [];\r\n const creditPullsArray = creditPullsData.map((init) => new FIMenuCreditPulls(init));\r\n\r\n this.creditPulls = creditPullsArray;\r\n\r\n return creditPullsArray;\r\n }\r\n\r\n async loadCustomerData(dealID) {\r\n let creditReport = null\r\n\r\n if (dealID) {\r\n creditReport = await this.getCreditReport(dealID)\r\n } else {\r\n creditReport = await this.getCreditReport()\r\n }\r\n\r\n this.creditReport = new FIMenuCreditReport(creditReport)\r\n this.getCreditPullsForCustomer(this.id)\r\n\r\n await this.getAndSetAssociatedCustomers(this.isEntity)\r\n }\r\n\r\n hasBasicRecordData() {\r\n const isCompany = util.isNullOrEmpty(this.dob) || this.isEntity;\r\n\r\n if (isCompany) return !!this.fullName;\r\n else return !!(this.dob && this.email && this.cell)\r\n }\r\n\r\n getPaperworkName() {\r\n if (this.isEntity && !util.isNullOrEmpty(this.fullName)) {\r\n return this.fullName\r\n } else if (!util.isNullOrEmpty(this.firstName) || !util.isNullOrEmpty(this.lastName)) {\r\n return `${this.prefix ?? \"\"} ${this.firstName ?? \"\"} ${this.middleName ?? \"\"} ${this.lastName ?? \"\"} ${this.suffix ?? \"\"}`.replace(\" \", \" \").trim();\r\n } else {\r\n return \"\";\r\n }\r\n }\r\n}","\r\n\r\n\r\n\r\n\r\n","\r\n\r\n\r\n","\r\n\r\n\r\n","\r\n\r\n\r\n","\r\n\r\n\r\n\r\n","\r\n\r\n\r\n\r\n","import util from '@core/services/util';\r\nimport ENUMS from \"@core/classes/Enums\"\r\nimport _ from 'underscore';\r\n\r\nexport default class RichTableHeader {\r\n constructor(init) {\r\n /** The corresponding property name */\r\n this.name = '';\r\n\r\n /** The text display for the column */\r\n this.display = '';\r\n\r\n this.columnOrder = 100;\r\n\r\n /** *CSS class for header + data cells */\r\n this.cssClass = '';\r\n\r\n /** CSS class for data cells only */\r\n this.cellCssClass = '';\r\n\r\n /** Font Awesome icon class name (replaces header display with icon) */\r\n this.icon = null;\r\n\r\n /** List of buttons/links to insert in either the data cells or the header (see documentation below) */\r\n this.actions = null;\r\n\r\n /** Name of slot to use for column's data cells */\r\n this.slot = null;\r\n\r\n this.component = null;\r\n\r\n /** If using component, changes what data the component is v-bind.sync to (see documentation below) */\r\n this.nonObject = false;\r\n\r\n /** List of headers that get stacked together into one column */\r\n this.subHeaders = null;\r\n\r\n /** Function whose return value gets displayed at the bottom of the column (passed no parameters) */\r\n this.footer = null;\r\n\r\n /** Only used for serverside data; whether or not to append '.keyword' to ElasticSearch query */\r\n this.useKeyword = false;\r\n\r\n /** An additional filtering function to apply when retrieving the row value */\r\n this.filter = null;\r\n\r\n this.value = null;\r\n\r\n /** Value function to use when exporting the table */\r\n this.printValue = null;\r\n\r\n this.sortable = false;\r\n\r\n /** Value function to use when sorting the column */\r\n this.sortValue = null;\r\n\r\n /** Sort direction (whether or no is ascending) */\r\n this.asc = null;\r\n\r\n this.searchable = false;\r\n\r\n this.rangeFilter = null;\r\n this.autoFilter = null;\r\n\r\n this.isVisible = true;\r\n this.isOpen = false;\r\n this.isSubHeader = false;\r\n this.dontAllowExport = false; // When true, this header will not show up on the export list when trying to export RichTable to file.\r\n this.anythingChanged = false;\r\n\r\n if (init) {\r\n this.name = ('name' in init) ? init.name : 'value';\r\n this.display = init.display;\r\n this.columnOrder = init.columnOrder ?? 100;\r\n this.cssClass = (init.cssClass ?? '') + (init.autoFilter || init.sortable || init.rangeFilter || init.subHeaders ? ' clickable' : '');\r\n this.cellCssClass = init.cellCssClass ?? '';\r\n this.icon = init.icon;\r\n this.actions = init.actions;\r\n this.slot = init.slot;\r\n this.component = init.component;\r\n this.nonObject = init.nonObject;\r\n this.subHeaders = init.subHeaders;\r\n this.footer = init.footer;\r\n this.useKeyword = init.useKeyword ?? false;\r\n this.isVisible = init.isVisible ?? true;\r\n this.dontAllowExport = init.dontAllowExport ?? false;\r\n this.isSubHeader = init.isSubHeader ?? false;\r\n\r\n this.sortable = ('sortable' in init) ? init.sortable : false;\r\n this.sortValue = init.sortValue;\r\n this.asc = init.asc;\r\n\r\n this.searchable = init.searchable ?? false;\r\n\r\n this.rangeFilter = (typeof init.rangeFilter === 'boolean' && init.rangeFilter)\r\n ? { min: null, max: null, rangeFilterType: ENUMS.RICHTABLE_RANGE_FILTER_TYPES.NUMERIC }\r\n : init.rangeFilter;\r\n\r\n if (!util.isNull(init.autoFilter) && typeof init.autoFilter === 'boolean' && init.autoFilter) {\r\n this.autoFilter = { values: null, searchText: null, deselectedValues: [], hideSearch: false, showAsFlexbox: false, gridDisplayColumns: null };\r\n }\r\n else if (!util.isNull(init.autoFilter) && typeof init.autoFilter === 'object') {\r\n this.autoFilter = {\r\n values: init.autoFilter.values.map(v => ({\r\n display: v.display,\r\n value: v.value,\r\n isSelected: v.isSelected\r\n })),\r\n searchText: null,\r\n deselectedValues: init.autoFilter.deselectedValues,\r\n hideSearch: init.autoFilter.hideSearch ?? false,\r\n showAsFlexbox: init.autoFilter.showAsFlexbox ?? false, // Boolean; Autofilter values displayed as a flexbox\r\n gridDisplayColumns: init.autoFilter.gridDisplayColumns ?? null // Number; Autofilter values displayed as a grid with gridDisplayColumns columns\r\n };\r\n }\r\n\r\n //A subheader group doesn't have its own value\r\n if (!init.subHeaders) {\r\n this.filter = init.filter;\r\n\r\n this.value = (!util.isNull(init.value) && util.isFunction(init.value))\r\n ? init.value\r\n : new Function('row', `return row.${init.rowValue ?? this.name}`);\r\n\r\n this.printValue = (!util.isNull(init.printValue) && util.isFunction(init.printValue))\r\n ? init.printValue\r\n : this.value;\r\n }\r\n }\r\n }\r\n\r\n initAutoFilters(initialData) {\r\n if (!this.autoFilter) return;\r\n\r\n //Autofilter values provided\r\n if (typeof this.autoFilter === 'object' && this.autoFilter.values) {\r\n this.autoFilter.deselectedValues = this.autoFilter.values.map(v => v.value);\r\n return;\r\n }\r\n\r\n //Generate autofilter values\r\n let allRowValues = [];\r\n if (initialData && initialData.length > 0) {\r\n let sampleValue = this.rowValue(initialData[0]);\r\n\r\n if (sampleValue && Array.isArray(sampleValue)) {\r\n if (sampleValue.length > 0)\r\n initialData.forEach(d => allRowValues.push(...this.rowValue(d)));\r\n }\r\n else {\r\n allRowValues = initialData.map(d => this.rowValue(d));\r\n }\r\n }\r\n\r\n let uniqueRowValues = _.uniq(allRowValues);\r\n let uniqueRowValuesWithMetaData = uniqueRowValues.map(v => {\r\n return {\r\n isSelected: false,\r\n display: v?.toString() ?? '',\r\n value: v?.toString() ?? ''\r\n };\r\n });\r\n\r\n let sortedValues = _.sortBy(uniqueRowValuesWithMetaData, s => s.display);\r\n this.autoFilter.values = sortedValues;\r\n this.autoFilter.deselectedValues = sortedValues.map(v => v.display);\r\n }\r\n\r\n rowValue(row) {\r\n return this.filter ? this.filter(this.value(row)) : this.value(row);\r\n }\r\n\r\n getCellCssClass(row) {\r\n if (util.isNull(this.cssClass) && util.isNull(this.cellCssClass)) return '';\r\n\r\n let secondClass = (util.isFunction(this.cellCssClass)) ? this.cellCssClass(row) : this.cellCssClass;\r\n let combinedCssClass = `${this.cssClass ?? ''} ${secondClass ?? ''}`;\r\n return combinedCssClass.trim();\r\n }\r\n\r\n getNumSelectedAutoFilters() {\r\n if (!this.autoFilter) return 0;\r\n return this.autoFilter.values.filter(v => v.isSelected).length;\r\n }\r\n\r\n autoFilterMenuAvailable() {\r\n if (!this.subHeaders || this.subHeaders.length < 1)\r\n return this.autoFilter || this.rangeFilter;\r\n\r\n return this.subHeaders.some(sh => sh.autoFilter || sh.sortable || sh.rangeFilter);\r\n }\r\n\r\n hasSelectedAutoFilter() {\r\n if (this.subHeaders)\r\n return this.subHeaders.some(sh => sh.autoFilter?.values?.some(v => v.isSelected));\r\n\r\n return !!this.autoFilter?.values?.some(v => v.isSelected);\r\n }\r\n\r\n hasActiveRangeFilter() {\r\n if (this.subHeaders) {\r\n return this.subHeaders.some(sh => {\r\n return sh.rangeFilter && (sh.rangeFilter.max !== null || sh.rangeFilter.min !== null);\r\n });\r\n }\r\n\r\n if (!this.rangeFilter) return false;\r\n return this.rangeFilter.max !== null || this.rangeFilter.min !== null;\r\n }\r\n\r\n hasFlexDisplay() {\r\n if (!this.autoFilter) return false;\r\n return this.autoFilter.showAsFlexbox && !this.autoFilter.gridDisplayColumns;\r\n }\r\n\r\n hasGridDisplay() {\r\n if (!this.autoFilter) return false;\r\n return (this.autoFilter.gridDisplayColumns && this.autoFilter.gridDisplayColumns > 0) && !this.autoFilter.showAsFlexbox;\r\n }\r\n\r\n getGridColumnCssVar() {\r\n if (!this.autoFilter?.gridDisplayColumns) return '';\r\n return `--grid-columns: ${this.autoFilter.gridDisplayColumns}`;\r\n }\r\n}\r\n\r\n/* ACTIONS\r\n * Format: [{type: '', name: '', text: '', cssClass: '', icon: '', header: true/false, action: () => {}, disabled: true/false }, ...]\r\n * Type: button | link | route (data cell only)\r\n * Header: if true, action will be inserted into the header (below the header's title) instead of the data cell\r\n * Action: function that gets called when the button/link is clicked\r\n * In Header: no parameters\r\n * In Data Cell: (row, rowIndex, tableData) => {}\r\n */\r\n\r\n/* NONOBJECT\r\n * True: component is v-bind.sync to { data: { nameValue: row._ref[header.name], value: header.value, row: row } }\r\n * False: component is v-bind.sync to { ...row[header.name] }\r\n */","import RichTableHeader from '@core/classes/RichTableHeader';\r\n\r\nexport class RichTableServerSide {\r\n refresh: () => Promise;\r\n pageNumber: number = 1;\r\n pageSize: number = 25;\r\n autoFilters: any[] = [];\r\n headers: any[] | RichTableHeader[] = [];\r\n results: any[] = [];\r\n sortBy: string = null;\r\n asc: boolean = false;\r\n searchBy: string = null;\r\n searchText: string = null;\r\n additionalObject: object = {};\r\n total: number = 0;\r\n searchAfter: ES_SearchAfter = null;\r\n\r\n constructor(partial?: Partial | any) {\r\n if (!partial) return;\r\n\r\n this.refresh = partial.refresh;\r\n this.pageNumber = partial.pageNumber ?? 1;\r\n this.pageSize = partial.pageSize ?? 25;\r\n this.autoFilters = partial.autoFilters ?? [];\r\n this.headers = partial.headers?.map((h: any) => new RichTableHeader(h)) ?? [];\r\n this.results = partial.results ?? [];\r\n this.sortBy = partial.sortBy;\r\n this.asc = partial.asc ?? false;\r\n this.searchBy = partial.searchBy;\r\n this.searchText = partial.searchText;\r\n this.additionalObject = partial.additionalObject ?? {};\r\n this.total = partial.total ?? 0;\r\n\r\n if (partial.searchAfter) this.searchAfter = new ES_SearchAfter(partial.searchAfter);\r\n }\r\n}\r\n\r\nexport class ES_SearchAfter {\r\n pageNumber: number = -1;\r\n searchAfter: any[] = null;\r\n\r\n constructor(init: ES_SearchAfter) {\r\n this.pageNumber = init.pageNumber ?? -1;\r\n this.searchAfter = init.searchAfter;\r\n }\r\n}\r\n","\r\n\r\n\r\n\r\n","\r\n","\r\n\r\n\r\n","\r\n\r\n\r\n\r\n","\r\n\r\n\r\n","\r\n\r\n\r\n","function __commonjs(fn, module) { return module = { exports: {} }, fn(module, module.exports), module.exports; }\n\n/**\n * The library's settings configuration object.\n *\n * Contains default parameters for currency and number formatting\n */\nvar settings = {\n symbol: '$', // default currency symbol is '$'\n format: '%s%v', // controls output: %s = symbol, %v = value (can be object, see docs)\n decimal: '.', // decimal point separator\n thousand: ',', // thousands separator\n precision: 2, // decimal places\n grouping: 3, // digit grouping (not implemented yet)\n stripZeros: false, // strip insignificant zeros from decimal part\n fallback: 0 // value returned on unformat() failure\n};\n\n/**\n * Takes a string/array of strings, removes all formatting/cruft and returns the raw float value\n * Alias: `accounting.parse(string)`\n *\n * Decimal must be included in the regular expression to match floats (defaults to\n * accounting.settings.decimal), so if the number uses a non-standard decimal\n * separator, provide it as the second argument.\n *\n * Also matches bracketed negatives (eg. '$ (1.99)' => -1.99)\n *\n * Doesn't throw any errors (`NaN`s become 0) but this may change in future\n *\n * ```js\n * accounting.unformat(\"ยฃ 12,345,678.90 GBP\"); // 12345678.9\n * ```\n *\n * @method unformat\n * @for accounting\n * @param {String|Array} value The string or array of strings containing the number/s to parse.\n * @param {Number} decimal Number of decimal digits of the resultant number\n * @return {Float} The parsed number\n */\nfunction unformat(value) {\n var decimal = arguments.length <= 1 || arguments[1] === undefined ? settings.decimal : arguments[1];\n var fallback = arguments.length <= 2 || arguments[2] === undefined ? settings.fallback : arguments[2];\n\n // Recursively unformat arrays:\n if (Array.isArray(value)) {\n return value.map(function (val) {\n return unformat(val, decimal, fallback);\n });\n }\n\n // Return the value as-is if it's already a number:\n if (typeof value === 'number') return value;\n\n // Build regex to strip out everything except digits, decimal point and minus sign:\n var regex = new RegExp('[^0-9-(-)-' + decimal + ']', ['g']);\n var unformattedValueString = ('' + value).replace(regex, '') // strip out any cruft\n .replace(decimal, '.') // make sure decimal point is standard\n .replace(/\\(([-]*\\d*[^)]?\\d+)\\)/g, '-$1') // replace bracketed values with negatives\n .replace(/\\((.*)\\)/, ''); // remove any brackets that do not have numeric value\n\n /**\n * Handling -ve number and bracket, eg.\n * (-100) = 100, -(100) = 100, --100 = 100\n */\n var negative = (unformattedValueString.match(/-/g) || 2).length % 2,\n absUnformatted = parseFloat(unformattedValueString.replace(/-/g, '')),\n unformatted = absUnformatted * (negative ? -1 : 1);\n\n // This will fail silently which may cause trouble, let's wait and see:\n return !isNaN(unformatted) ? unformatted : fallback;\n}\n\n/**\n * Check and normalise the value of precision (must be positive integer)\n */\nfunction _checkPrecision(val, base) {\n val = Math.round(Math.abs(val));\n return isNaN(val) ? base : val;\n}\n\n/**\n * Implementation of toFixed() that treats floats more like decimals\n *\n * Fixes binary rounding issues (eg. (0.615).toFixed(2) === '0.61') that present\n * problems for accounting- and finance-related software.\n *\n * ```js\n * (0.615).toFixed(2); // \"0.61\" (native toFixed has rounding issues)\n * accounting.toFixed(0.615, 2); // \"0.62\"\n * ```\n *\n * @method toFixed\n * @for accounting\n * @param {Float} value The float to be treated as a decimal number.\n * @param {Number} [precision=2] The number of decimal digits to keep.\n * @return {String} The given number transformed into a string with the given precission\n */\nfunction toFixed(value, precision) {\n precision = _checkPrecision(precision, settings.precision);\n var power = Math.pow(10, precision);\n\n // Multiply up by precision, round accurately, then divide and use native toFixed():\n return (Math.round((value + 1e-8) * power) / power).toFixed(precision);\n}\n\nvar index = __commonjs(function (module) {\n/* eslint-disable no-unused-vars */\n'use strict';\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nvar propIsEnumerable = Object.prototype.propertyIsEnumerable;\n\nfunction toObject(val) {\n\tif (val === null || val === undefined) {\n\t\tthrow new TypeError('Object.assign cannot be called with null or undefined');\n\t}\n\n\treturn Object(val);\n}\n\nmodule.exports = Object.assign || function (target, source) {\n\tvar from;\n\tvar to = toObject(target);\n\tvar symbols;\n\n\tfor (var s = 1; s < arguments.length; s++) {\n\t\tfrom = Object(arguments[s]);\n\n\t\tfor (var key in from) {\n\t\t\tif (hasOwnProperty.call(from, key)) {\n\t\t\t\tto[key] = from[key];\n\t\t\t}\n\t\t}\n\n\t\tif (Object.getOwnPropertySymbols) {\n\t\t\tsymbols = Object.getOwnPropertySymbols(from);\n\t\t\tfor (var i = 0; i < symbols.length; i++) {\n\t\t\t\tif (propIsEnumerable.call(from, symbols[i])) {\n\t\t\t\t\tto[symbols[i]] = from[symbols[i]];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn to;\n};\n});\n\nvar objectAssign = (index && typeof index === 'object' && 'default' in index ? index['default'] : index);\n\nfunction _stripInsignificantZeros(str, decimal) {\n var parts = str.split(decimal);\n var integerPart = parts[0];\n var decimalPart = parts[1].replace(/0+$/, '');\n\n if (decimalPart.length > 0) {\n return integerPart + decimal + decimalPart;\n }\n\n return integerPart;\n}\n\n/**\n * Format a number, with comma-separated thousands and custom precision/decimal places\n * Alias: `accounting.format()`\n *\n * Localise by overriding the precision and thousand / decimal separators\n *\n * ```js\n * accounting.formatNumber(5318008); // 5,318,008\n * accounting.formatNumber(9876543.21, { precision: 3, thousand: \" \" }); // 9 876 543.210\n * ```\n *\n * @method formatNumber\n * @for accounting\n * @param {Number} number The number to be formatted.\n * @param {Object} [opts={}] Object containing all the options of the method.\n * @return {String} The given number properly formatted.\n */\nfunction formatNumber(number) {\n var opts = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];\n\n // Resursively format arrays:\n if (Array.isArray(number)) {\n return number.map(function (val) {\n return formatNumber(val, opts);\n });\n }\n\n // Build options object from second param (if object) or all params, extending defaults:\n opts = objectAssign({}, settings, opts);\n\n // Do some calc:\n var negative = number < 0 ? '-' : '';\n var base = parseInt(toFixed(Math.abs(number), opts.precision), 10) + '';\n var mod = base.length > 3 ? base.length % 3 : 0;\n\n // Format the number:\n var formatted = negative + (mod ? base.substr(0, mod) + opts.thousand : '') + base.substr(mod).replace(/(\\d{3})(?=\\d)/g, '$1' + opts.thousand) + (opts.precision > 0 ? opts.decimal + toFixed(Math.abs(number), opts.precision).split('.')[1] : '');\n\n return opts.stripZeros ? _stripInsignificantZeros(formatted, opts.decimal) : formatted;\n}\n\nvar index$1 = __commonjs(function (module) {\n'use strict';\n\nvar strValue = String.prototype.valueOf;\nvar tryStringObject = function tryStringObject(value) {\n\ttry {\n\t\tstrValue.call(value);\n\t\treturn true;\n\t} catch (e) {\n\t\treturn false;\n\t}\n};\nvar toStr = Object.prototype.toString;\nvar strClass = '[object String]';\nvar hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';\n\nmodule.exports = function isString(value) {\n\tif (typeof value === 'string') { return true; }\n\tif (typeof value !== 'object') { return false; }\n\treturn hasToStringTag ? tryStringObject(value) : toStr.call(value) === strClass;\n};\n});\n\nvar isString = (index$1 && typeof index$1 === 'object' && 'default' in index$1 ? index$1['default'] : index$1);\n\n/**\n * Parses a format string or object and returns format obj for use in rendering\n *\n * `format` is either a string with the default (positive) format, or object\n * containing `pos` (required), `neg` and `zero` values\n *\n * Either string or format.pos must contain \"%v\" (value) to be valid\n *\n * @method _checkCurrencyFormat\n * @for accounting\n * @param {String} [format=\"%s%v\"] String with the format to apply, where %s is the currency symbol and %v is the value.\n * @return {Object} object represnting format (with pos, neg and zero attributes)\n */\nfunction _checkCurrencyFormat(format) {\n // Format should be a string, in which case `value` ('%v') must be present:\n if (isString(format) && format.match('%v')) {\n // Create and return positive, negative and zero formats:\n return {\n pos: format,\n neg: format.replace('-', '').replace('%v', '-%v'),\n zero: format\n };\n }\n\n // Otherwise, assume format was fine:\n return format;\n}\n\n/**\n * Format a number into currency\n *\n * Usage: accounting.formatMoney(number, symbol, precision, thousandsSep, decimalSep, format)\n * defaults: (0, '$', 2, ',', '.', '%s%v')\n *\n * Localise by overriding the symbol, precision, thousand / decimal separators and format\n *\n * ```js\n * // Default usage:\n * accounting.formatMoney(12345678); // $12,345,678.00\n *\n * // European formatting (custom symbol and separators), can also use options object as second parameter:\n * accounting.formatMoney(4999.99, { symbol: \"โ‚ฌ\", precision: 2, thousand: \".\", decimal: \",\" }); // โ‚ฌ4.999,99\n *\n * // Negative values can be formatted nicely:\n * accounting.formatMoney(-500000, { symbol: \"ยฃ \", precision: 0 }); // ยฃ -500,000\n *\n * // Simple `format` string allows control of symbol position (%v = value, %s = symbol):\n * accounting.formatMoney(5318008, { symbol: \"GBP\", format: \"%v %s\" }); // 5,318,008.00 GBP\n * ```\n *\n * @method formatMoney\n * @for accounting\n * @param {Number} number Number to be formatted.\n * @param {Object} [opts={}] Object containing all the options of the method.\n * @return {String} The given number properly formatted as money.\n */\nfunction formatMoney(number) {\n var opts = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];\n\n // Resursively format arrays:\n if (Array.isArray(number)) {\n return number.map(function (val) {\n return formatMoney(val, opts);\n });\n }\n\n // Build options object from second param (if object) or all params, extending defaults:\n opts = objectAssign({}, settings, opts);\n\n // Check format (returns object with pos, neg and zero):\n var formats = _checkCurrencyFormat(opts.format);\n\n // Choose which format to use for this value:\n var useFormat = undefined;\n\n if (number > 0) {\n useFormat = formats.pos;\n } else if (number < 0) {\n useFormat = formats.neg;\n } else {\n useFormat = formats.zero;\n }\n\n // Return with currency symbol added:\n return useFormat.replace('%s', opts.symbol).replace('%v', formatNumber(Math.abs(number), opts));\n}\n\n/**\n * Format a list of numbers into an accounting column, padding with whitespace\n * to line up currency symbols, thousand separators and decimals places\n *\n * List should be an array of numbers\n *\n * Returns array of accouting-formatted number strings of same length\n *\n * NB: `white-space:pre` CSS rule is required on the list container to prevent\n * browsers from collapsing the whitespace in the output strings.\n *\n * ```js\n * accounting.formatColumn([123.5, 3456.49, 777888.99, 12345678, -5432], { symbol: \"$ \" });\n * ```\n *\n * @method formatColumn\n * @for accounting\n * @param {Array} list An array of numbers to format\n * @param {Object} [opts={}] Object containing all the options of the method.\n * @param {Object|String} [symbol=\"$\"] String with the currency symbol. For conveniency if can be an object containing all the options of the method.\n * @param {Integer} [precision=2] Number of decimal digits\n * @param {String} [thousand=','] String with the thousands separator.\n * @param {String} [decimal=\".\"] String with the decimal separator.\n * @param {String} [format=\"%s%v\"] String with the format to apply, where %s is the currency symbol and %v is the value.\n * @return {Array} array of accouting-formatted number strings of same length\n */\nfunction formatColumn(list) {\n var opts = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];\n\n if (!list) return [];\n\n // Build options object from second param (if object) or all params, extending defaults:\n opts = objectAssign({}, settings, opts);\n\n // Check format (returns object with pos, neg and zero), only need pos for now:\n var formats = _checkCurrencyFormat(opts.format);\n\n // Whether to pad at start of string or after currency symbol:\n var padAfterSymbol = formats.pos.indexOf('%s') < formats.pos.indexOf('%v');\n\n // Store value for the length of the longest string in the column:\n var maxLength = 0;\n\n // Format the list according to options, store the length of the longest string:\n var formatted = list.map(function (val) {\n if (Array.isArray(val)) {\n // Recursively format columns if list is a multi-dimensional array:\n return formatColumn(val, opts);\n }\n // Clean up the value\n val = unformat(val, opts.decimal);\n\n // Choose which format to use for this value (pos, neg or zero):\n var useFormat = undefined;\n\n if (val > 0) {\n useFormat = formats.pos;\n } else if (val < 0) {\n useFormat = formats.neg;\n } else {\n useFormat = formats.zero;\n }\n\n // Format this value, push into formatted list and save the length:\n var fVal = useFormat.replace('%s', opts.symbol).replace('%v', formatNumber(Math.abs(val), opts));\n\n if (fVal.length > maxLength) {\n maxLength = fVal.length;\n }\n\n return fVal;\n });\n\n // Pad each number in the list and send back the column of numbers:\n return formatted.map(function (val) {\n // Only if this is a string (not a nested array, which would have already been padded):\n if (isString(val) && val.length < maxLength) {\n // Depending on symbol position, pad after symbol or at index 0:\n return padAfterSymbol ? val.replace(opts.symbol, opts.symbol + new Array(maxLength - val.length + 1).join(' ')) : new Array(maxLength - val.length + 1).join(' ') + val;\n }\n return val;\n });\n}\n\nexport { settings, unformat, toFixed, formatMoney, formatNumber, formatColumn, formatMoney as format, unformat as parse };\n//# sourceMappingURL=accounting.es6.js.map","\r\n\r\n\r\n","\r\n \r\n \r\n \r\n \r\n \r\n\r\n\r\n\r\n\r\n","\r\n \r\n \r\n \r\n \r\n \r\n\r\n\r\n\r\n\r\n","\r\n\r\n\r\n\r\n\r\n","\r\n\r\n\r\n","import { computed, ref } from 'vue'\r\nimport api from '@core/services/api'\r\nimport ApplicationsBusinessInfo from '@core/classes/Applications/ApplicationsBusinessInfo'\r\nimport { defineStore } from 'pinia'\r\nimport moment from 'moment'\r\n\r\nexport const useBusinessStore = defineStore('business', () => {\r\n // State\r\n const business = ref(null)\r\n\r\n // Getter\r\n const getBusiness = computed(() => business.value);\r\n const formattedBusinessStartDate = computed(() => {\r\n return business.value?.businessInfo?.businessStartDate\r\n ? moment(business.value.businessInfo.businessStartDate).format('MM/DD/YYYY')\r\n : '';\r\n });\r\n\r\n // Actions\r\n const getBusinessInformationFromBackend = async (id: string) => {\r\n try {\r\n const response = await api.customerPortal.getBusinessInformation(id);\r\n if (response && response?.status === 200 && response.data) {\r\n setBusiness(response.data.payload.businessInfo)\r\n }\r\n } catch (error) {\r\n console.error(error, \"Error retrieving Business information\")\r\n clearBusiness()\r\n }\r\n }\r\n\r\n const clearBusiness = () => {\r\n business.value = {}\r\n }\r\n\r\n const setBusiness = (newBusiness: any) => {\r\n business.value = newBusiness;\r\n }\r\n\r\n const getBusinessFormData = computed(() => {\r\n if (!business.value) return null;\r\n \r\n return {\r\n legalName: business.value.legalName ?? \"\",\r\n entityType: business.value.entityType ?? null,\r\n phoneNumber: business.value.phoneNumber ?? \"\",\r\n businessStartDate: business.value.businessStartDate ?? \"\",\r\n \r\n };\r\n });\r\n\r\n return {\r\n business,\r\n getBusinessInformationFromBackend,\r\n getBusiness,\r\n getBusinessFormData,\r\n formattedBusinessStartDate,\r\n clearBusiness,\r\n setBusiness,\r\n }\r\n})\r\n","import CustomerApplicationHelper, {\r\n checkIfWeNeedANewApplication,\r\n createCustomerApplicationFromCustomer,\r\n hasCustomerApplication,\r\n isCreditApplicationComplete,\r\n isEditApplicationPastDayLimit,\r\n} from \"@core/helpers/customer-application-helper\";\r\nimport $modal from \"@core/services/modal\";\r\nimport api from \"@core/services/api\";\r\nimport Application from \"@core/classes/Applications/Application\";\r\nimport ApplicationsBusinessInfo from \"@core/classes/Applications/ApplicationsBusinessInfo\";\r\nimport ApplicationsPreFilledData from \"@core/classes/Applications/ApplicationsPreFilledData\";\r\nimport CustomerRecord from \"@core/classes/Customer/CustomerRecord\";\r\nimport { CustomerType } from \"@core/classes/SharedEnums\";\r\nimport FIMenuCustomer from \"@core/classes/FIMenuCustomer\";\r\nimport LogRocket from \"logrocket\";\r\nimport { MobileVerifyRequest } from \"@core/classes/Requests/MobileVerifyRequest\";\r\nimport modalApplicantInfo from \"@core/modals/modalApplicantInfo.vue\";\r\nimport modalConfirmCustomerInfo from \"@core/modals/modalConfirmCustomerInfo.vue\";\r\nimport modalFullCustomerApplication from \"@core/modals/modalFullCustomerApplication.vue\";\r\nimport ModalInfo from \"@core/modals/modalInfo.vue\";\r\nimport modalRetrieveCustomer from \"@core/modals/modalRetrieveCustomer.vue\";\r\nimport modalSendLinkToCustomer from \"@core/modals/modalSendLinkToCustomer.vue\";\r\nimport { nextTick} from 'vue';\r\nimport { Router } from \"vue-router\";\r\nimport SaturnResponse from \"@core/classes/Responses/SaturnResponse\";\r\nimport { useBusinessStore } from \"@core/stores/BusinessStore\";\r\nimport { useUserStore } from \"@core/stores/UserStore\";\r\nimport util from \"@core/services/util\";\r\n\r\ninterface IEmailRequest {\r\n sendToList: string[];\r\n isBodyHtml: boolean;\r\n emailSubject?: string;\r\n emailBody?: string;\r\n}\r\n\r\ninterface IPhoneRequest {\r\n toPhoneNumber: string;\r\n body: string;\r\n storeCode: string;\r\n}\r\n\r\nexport interface IStore {\r\n additions: any[];\r\n cdkCode: string;\r\n cdkSettings: any;\r\n countyTaxRate: number;\r\n customerApplicationSettings: any;\r\n defaultFees: any[];\r\n emailAddressesForHouseDeals: string;\r\n emailAddressesForHouseUnwind: string;\r\n emailAddressesForReports: string;\r\n gwcCode: string;\r\n id: string;\r\n isLeasePaymentTaxed: boolean;\r\n meta: any;\r\n nsdCode: string;\r\n partnerCodes: any[];\r\n preloads: any[];\r\n products: any[];\r\n stateTaxRate: number;\r\n storeAccountingInfo: any;\r\n storeAddress: string;\r\n storeAddressExtra: string;\r\n storeCity: string;\r\n storeCode: string;\r\n storeCounty: string;\r\n storeDateTime: Date;\r\n storeFiles: any[];\r\n storeName: string;\r\n storePhone: string;\r\n storeSettings: any;\r\n storeState: string;\r\n storeTimeZone: string;\r\n storeUser: string;\r\n storeWebsiteUrl: string;\r\n storeZip: string;\r\n usWarrantyCompanyCode: string;\r\n usWarrantyStoreCode: string;\r\n}\r\n\r\n/*\r\n @@@@@@@@@@ ---> READ ME <--- @@@@@@@@@@\r\n\r\n Let's keep the methods clean and focused. Implement specific solutions directly within the\r\n main code rather than using helpers. However, if you think an implementation will be reused in different\r\n places, feel free to add more parameters to the current methods or create new methods.\r\n*/\r\n\r\nexport async function openRetrieveCustomersModal(\r\n {\r\n actionOnRetrieveCustomer = (arg: any) => { },\r\n actionOnRetrieveCompany = (arg: any) => { },\r\n canRetrieveCompany = true,\r\n },\r\n toggleCreateLead = false\r\n) {\r\n const modalParams = {\r\n name: \"modalRetrieveCustomer\",\r\n passedData: {\r\n modalView: true,\r\n actionOnRetrieveCustomer: actionOnRetrieveCustomer,\r\n actionOnRetrieveCompany: actionOnRetrieveCompany,\r\n canRetrieveCompany,\r\n canCreateLeads: toggleCreateLead,\r\n openModalApplicantInfo: openModalApplicantInfo,\r\n },\r\n backdrop: true,\r\n };\r\n $modal.open(modalRetrieveCustomer, modalParams);\r\n}\r\n\r\n/**\r\n * Opens a modal to display applicantInfoPanel\r\n * @param store\r\n * @param customer\r\n * @returns\r\n */\r\nexport async function openModalApplicantInfo(store: any, customer = new FIMenuCustomer()) {\r\n const modalParams = {\r\n name: \"modalApplicantInfo\",\r\n passedData: {\r\n title: \"Create Customer Application\",\r\n prefilledData: new ApplicationsPreFilledData(),\r\n acceptText: \"Create\",\r\n cancelText: \"Close\",\r\n isCustomer: true,\r\n customer: customer,\r\n store: store,\r\n },\r\n backdrop: false,\r\n };\r\n\r\n return $modal.open(modalApplicantInfo, modalParams);\r\n}\r\n\r\n/**\r\n * This method creates a customer application from an FIMenu Customer. Ideally should be customer\r\n *\r\n * @param storeCode\r\n * @param customer FIMenuCustomer\r\n * @param lng Either \"English\" or \"Spanish\"\r\n */\r\nexport async function openModalCreateCustomerApplicationFromCustomer(\r\n storeCode: string,\r\n customer: FIMenuCustomer,\r\n lng = \"English\"\r\n) {\r\n const modalParams = {\r\n name: \"modalConfirmCustomerInfo\",\r\n passedData: {\r\n title: \"Create Customer Application\",\r\n info: \"Please confirm the e-mail and cellular phone number are accurate. We will be sending an e-mail and SMS code to create the quote application.\",\r\n id: customer.id,\r\n customer: customer,\r\n isCustomer: true,\r\n acceptText: \"Create\",\r\n cancelText: \"Cancel\",\r\n language: lng,\r\n storeCode: storeCode,\r\n },\r\n backdrop: false,\r\n };\r\n $modal.open(modalConfirmCustomerInfo, modalParams);\r\n}\r\n\r\n/**\r\n * Display a full customer application\r\n * @param customer FIMenuCustomer\r\n */\r\nexport async function openModalDisplayFullCustomerApplication(customer: FIMenuCustomer) {\r\n $modal.open(modalFullCustomerApplication, {\r\n name: \"modalFullCustomerApplication\",\r\n passedData: {\r\n customer: customer,\r\n },\r\n backdrop: true,\r\n });\r\n}\r\n\r\nexport async function openModalSendLinkToCustomer(\r\n customer: FIMenuCustomer,\r\n storeCode: string,\r\n title: string,\r\n questionKey: string,\r\n isSingleQuestionEdit = null as boolean,\r\n resetDateCompleted = false,\r\n customerType: CustomerType = CustomerType.Customer\r\n) {\r\n $modal.open(modalSendLinkToCustomer, {\r\n name: \"modalSendLinkToCustomer\",\r\n passedData: {\r\n title: `${title} Section`,\r\n generateLink: () => generateApplicationEditLink(customer, storeCode, questionKey, isSingleQuestionEdit, resetDateCompleted, true),\r\n handleSMSIssue: async () => await handleSMSIssue(customer.id, storeCode, customerType),\r\n },\r\n backdrop: true,\r\n postFunction: (sendLinkMethod: string) =>\r\n sendLinkToCustomer(customer, storeCode, sendLinkMethod, questionKey, isSingleQuestionEdit, resetDateCompleted),\r\n });\r\n}\r\n\r\nexport async function generateApplicationEditLink(\r\n customer: FIMenuCustomer,\r\n storeCode: string,\r\n questionKey: string,\r\n isSingleQuestionEdit = null as boolean,\r\n resetDateCompleted = false,\r\n isInStore = false\r\n) {\r\n const response = await api.applications.generateApplicationEditLink({\r\n questionKey,\r\n isSingleQuestionEdit,\r\n resetDateCompleted,\r\n applicationId: customer.customerApplication.id,\r\n storeCode: storeCode,\r\n isInStore: isInStore,\r\n });\r\n\r\n return response.data;\r\n}\r\n\r\nexport async function sendLinkToCustomer(\r\n customer: FIMenuCustomer,\r\n storeCode: string,\r\n sendLinkMethod: string,\r\n questionKey: string,\r\n isSingleQuestionEdit = null as boolean,\r\n resetDateCompleted = false\r\n) {\r\n let link = await generateApplicationEditLink(customer, storeCode, questionKey, isSingleQuestionEdit, resetDateCompleted);\r\n\r\n const newLinkRequest = {\r\n originalLink: link,\r\n domain: \"https://\" + window.location.host,\r\n store: storeCode,\r\n phoneNumber: customer.customerApplication.preFilledData.phoneNumber,\r\n };\r\n\r\n let newLink = link;\r\n await api.applications.getRedirectLink(newLinkRequest).then((response: any) => {\r\n if (response.data) {\r\n newLink = response.data;\r\n }\r\n });\r\n\r\n if (sendLinkMethod == \"email\") {\r\n const request: any = {\r\n sendToList: [customer.email],\r\n isBodyHtml: true,\r\n };\r\n\r\n if (customer.customerApplication.quoteAppData.language == \"Spanish\") {\r\n request.emailSubject = \"Actualizaciรณn de Aplicaciรณn\";\r\n request.emailBody = `

Por favor siga el enlace para actualizar su aplicaciรณn:

Edit Application`;\r\n } else {\r\n request.emailSubject = \"Application Update\";\r\n request.emailBody = `

Please follow the link to update your application:

Edit Application`;\r\n }\r\n\r\n api.applications\r\n .sendEditLink({ applicationId: customer.customerApplication.id, emailRequest: request })\r\n .then((response: any) => {\r\n if (response.data) {\r\n util.toastr(\"success\", \"Success\", \"Successfully sent email\");\r\n }\r\n })\r\n .catch((error: any) => {\r\n // eslint-disable-next-line no-console\r\n console.error(\"Error\", error);\r\n util.toastr(\"error\", \"Error\", \"Failed to send text email\");\r\n });\r\n } else if (sendLinkMethod == \"text\") {\r\n const request = {\r\n toPhoneNumber: \"+1\" + customer.cell,\r\n body:\r\n customer.customerApplication.quoteAppData.language == \"Spanish\"\r\n ? \"Por favor siga el enlace para actualizar su aplicaciรณn: ${newLink}\"\r\n : \"Please follow the link to update your application: \" + newLink,\r\n storeCode: storeCode,\r\n };\r\n\r\n api.applications\r\n .sendEditLink({ applicationId: customer.customerApplication.id, messageRequest: request })\r\n .then((response: any) => {\r\n if (response.data) {\r\n util.toastr(\"success\", \"Success\", \"Successfully sent message\");\r\n }\r\n })\r\n .catch((error: any) => {\r\n // eslint-disable-next-line no-console\r\n console.error(\"Error\", error);\r\n util.toastr(\"error\", \"Error\", \"Failed to send message\");\r\n });\r\n }\r\n}\r\n\r\n\r\n\r\n\r\n\r\n\r\n//#region ----------Direct Customer Stuff ------- //\r\n\r\nexport async function sendPortalLink(request: object) {\r\n try {\r\n let portalLinkResponse = await api.customerPortal.sendPortalLink(request);\r\n if (portalLinkResponse.status == 200 && portalLinkResponse.data) {\r\n util.toastr(\"success\", \"Success\", \"Successfully sent.\");\r\n return portalLinkResponse.data;\r\n }\r\n } catch (error) {\r\n util.toastr(\"error\", \"Error\", \"Failed to send.\");\r\n }\r\n}\r\n\r\nexport async function generateTinyUrl(link: string, storeCode: string, phoneNumber: string) {\r\n const newLinkRequest = {\r\n originalLink: link,\r\n domain: \"https://\" + window.location.host,\r\n storeCode: storeCode,\r\n phoneNumber: phoneNumber,\r\n };\r\n\r\n try {\r\n const shortRedirectLink = await api.applications.getRedirectLink(newLinkRequest);\r\n if (shortRedirectLink.status == 200 && shortRedirectLink.data) {\r\n return shortRedirectLink.data;\r\n }\r\n } catch (error) {\r\n throw new Error(\"Error generating short link.\");\r\n }\r\n}\r\n\r\nexport const getCustomerById = async (id: string) => {\r\n try {\r\n const customerResponse = await api.customers.getCustomerById(id);\r\n if (customerResponse?.data) {\r\n return customerResponse.data\r\n }\r\n else return null;\r\n\r\n } catch (error) {\r\n console.error(error)\r\n }\r\n}\r\n\r\nexport const getCustomerAndGenerateLink = async (encryptedId: string): Promise => {\r\n try {\r\n // decryptId\r\n if (!encryptedId) return null;\r\n const decryptedId = util.decryptJSONText(encryptedId);\r\n const customerId = JSON.parse(decryptedId);\r\n\r\n //Get customer and application by id\r\n const { customer, customerApplication } = await getInformationForCustomerPortal(customerId);\r\n\r\n const link = await generateLinkForQRCode(customer, null, customer.storeCodes[0], false, customerApplication);\r\n return link;\r\n\r\n } catch (error) {\r\n util.toastr('error', 'Error', 'Unable to retrieve information. Please contact support.')\r\n console.error(error)\r\n }\r\n}\r\n\r\nexport const generateLinkForQRCode = async (customer: any, store: IStore, storeCode: string = null, shouldCheckIfCustomerApp = true, customerApplication: Application = null) => {\r\n const currentStoreCode = store?.storeCode ?? storeCode ?? null;\r\n if(currentStoreCode == null) return null;\r\n\r\n let currentCustomerApp = customer.customerApplication ?? customerApplication ?? null;\r\n\r\n // currentCustomerApp being null can be the case for customers who were created before CustomerApp launched\r\n if (shouldCheckIfCustomerApp || currentCustomerApp == null) {\r\n const newCustomerApp = await checkIfWeNeedANewApplication(customer, null, currentStoreCode);\r\n // Only update `currentCustomerApp` if `newCustomerApp` is not null or undefined (it entered the if stmt)\r\n if (newCustomerApp != null) {\r\n currentCustomerApp = newCustomerApp;\r\n }\r\n }\r\n\r\n const phone = customer.cell ?? customer.customerApplication.preFilledData.phoneNumber;\r\n const phoneLastFour = phone.toString().slice(-4);\r\n const link: string = `/customer-portal/phoneVerification?emailCode=${currentCustomerApp?.emailCode}&storeCode=${currentStoreCode}&lastFour=${phoneLastFour}`;\r\n\r\n const shortLink = await generateTinyUrl(link, currentStoreCode, phone);\r\n return shortLink;\r\n}\r\n\r\nexport async function sendLinkToCustomerForPortal(\r\n customer: FIMenuCustomer,\r\n language: string,\r\n store: IStore,\r\n sendLinkMethod: string,\r\n) {\r\n if (!customer.customerApplication || CustomerApplicationHelper.isCustomerApplicationExpiredByGlobalSettingsCheck(customer.customerApplication.dateCompleted)) {\r\n try {\r\n let customerApp = await createCustomerApplicationFromCustomer(null, customer, false, store.storeCode);\r\n customer.customerApplication = customerApp;\r\n if (customerApp != null) return util.toastr(\"success\", \"Success\", \"Successfully sent.\");\r\n } catch (error) {\r\n util.toastr(\"error\", \"Error\", \"Error sending link to customer. Try again.\");\r\n }\r\n }\r\n\r\n let spanishMessage: string = \"Por favor siga el enlace para entrar en su portal\";\r\n let spanishButtonText: string = \"Entra al portal\";\r\n let englishMessage: string = \"Please follow the link to enter your portal\";\r\n let englishButtonText: string = \"Enter portal\";\r\n const phone: string = customer.cell ?? customer.customerApplication.preFilledData.phoneNumber;\r\n const phoneLastFour: string = phone.toString().slice(-4);\r\n let link: string = `/customer-portal/phoneVerification?emailCode=${customer.customerApplication?.emailCode}&storeCode=${store.storeCode}&lastFour=${phoneLastFour}`;\r\n // let link = await redirectToCustomerPortal(customer.id);\r\n let shortLink = await generateTinyUrl(link, store.storeCode, phone);\r\n if (sendLinkMethod == \"email\") {\r\n const emailRequest: IEmailRequest = {\r\n sendToList: [customer.email],\r\n isBodyHtml: true,\r\n emailSubject: null,\r\n emailBody: null,\r\n };\r\n\r\n if (language == \"Spanish\") {\r\n emailRequest.emailSubject = \"Entra al Portal\";\r\n emailRequest.emailBody = `

${spanishMessage}:

${spanishButtonText}`;\r\n } else {\r\n emailRequest.emailSubject = \"Enter Portal\";\r\n emailRequest.emailBody = `

${englishMessage}:

${englishButtonText}`;\r\n }\r\n\r\n sendPortalLink({ applicationId: customer.customerApplication.id, emailRequest: emailRequest });\r\n } else if (sendLinkMethod == \"text\") {\r\n const phoneRequest: IPhoneRequest = {\r\n toPhoneNumber: \"+1\" + customer.cell,\r\n body: language == \"Spanish\" ? `${spanishMessage}: ${shortLink}` : `${englishMessage}: ${shortLink}`,\r\n storeCode: store.storeCode,\r\n };\r\n\r\n sendPortalLink({ applicationId: customer.customerApplication.id, messageRequest: phoneRequest });\r\n }\r\n}\r\n\r\n/** For manually verifying the OTP */\r\nexport async function handleSMSIssue(customerId: string, storeCode: string, customerType: CustomerType) {\r\n nextTick(() => {\r\n $modal.open(ModalInfo, {\r\n name: \"modalInfo\",\r\n passedData: {\r\n title: \"Notifying General Managers\",\r\n info: `This action will notify all GENERAL MANAGERS located at store: ${storeCode}.\\n\\nThey will provide you with the One Time Password, on the Customer's behalf.`,\r\n additionalInfo:\"Please ensure that the customer is who they claim they are before giving them the OTP.\",\r\n acceptText: \"I Accept\",\r\n cancelText: \"Cancel\",\r\n },\r\n backdrop: true,\r\n postFunction: async () => {\r\n try {\r\n const mobileVerifyRequest = new MobileVerifyRequest({customerId, storeCode, customerType})\r\n const response = (await api.applications.manuallyVerifyOTP(mobileVerifyRequest))?.data;\r\n if (response && response.messages.length < 1) {\r\n util.toastr(\"success\", \"One Time Password\", \"General Manager(s) Were Notified!\");\r\n } else {\r\n util.toastr(\"error\", \"One Time Password\", response.messages[0]);\r\n }\r\n } catch (error) {\r\n util.toastr(\"error\", \"One Time Password\", error);\r\n console.error(error);\r\n }\r\n },\r\n });\r\n })\r\n}\r\n\r\n/**\r\n * @param customerId\r\n * @returns This is a direct link to the portal\r\n */\r\nexport async function redirectToCustomerPortal(customerId: string) {\r\n try {\r\n const response = await api.customerPortal.redirectToPortal(customerId);\r\n\r\n if (response && response.status == 200 && response.data) {\r\n return response.data;\r\n }\r\n } catch (error) {\r\n throw new Error(\"Unable to redirect to customer portal link\");\r\n }\r\n}\r\n\r\nexport async function getInformationForCustomerPortal(customerId: string) {\r\n try {\r\n const response = await api.customerPortal.getCustomerInformation(customerId);\r\n if (response.status == 200) {\r\n const responseData = response.data;\r\n\r\n if (responseData.payload && responseData.statusCode == 200) {\r\n const customer = new CustomerRecord(responseData.payload.customer);\r\n const customerApplication = new Application(responseData.payload.customerApplication);\r\n const businessCustomer = responseData.payload.businessCustomer;\r\n\r\n return {\r\n customer,\r\n customerApplication,\r\n businessCustomer,\r\n };\r\n }\r\n }\r\n } catch (error) {\r\n console.error(error, \"Error retrieving customer information\");\r\n }\r\n return null;\r\n}\r\n\r\n/** @param {CustomerRecord} businessCustomer @returns a Customer Record for Business Customer. */\r\nexport async function createBusinessCustomer(\r\n businessCustomer: ApplicationsBusinessInfo,\r\n primaryCustomerId: string | string[],\r\n storeCodes:string[]\r\n) {\r\n try {\r\n const createBusinessCustomerRequest = {\r\n businessCustomer: businessCustomer,\r\n primaryCustomerId: primaryCustomerId,\r\n storeCodes: storeCodes\r\n };\r\n\r\n const businessResponse =\r\n await api.customerPortal.createBusinessCustomerFromPortal(createBusinessCustomerRequest);\r\n if (businessResponse.status == 200 && businessResponse.data.payload !== null) {\r\n util.toastr(\"success\", \"Success\", \"Successfully added business.\");\r\n const businessStore = useBusinessStore();\r\n const userStore = useUserStore()\r\n\r\n businessStore.setBusiness(businessResponse.data.payload);\r\n userStore.setBusinessData(businessResponse.data.payload);\r\n return businessStore;\r\n }\r\n if (businessResponse.status == 400 && businessResponse.data.payload == null) {\r\n util.toastr(\"error\", \"Error\", \"Error creating business. Try again.\");\r\n return;\r\n }\r\n } catch (error) {\r\n LogRocket.log(\"Error creating business customer\", error);\r\n util.toastr(\"error\", \"Error\", \"Error adding. Please reach out to support.\");\r\n }\r\n}\r\n\r\n/**\r\n * Maps ApplicationsBusinessInfo to CustomerRecord\r\n * @param {ApplicationsBusinessInfo} businessInfo\r\n * @returns {CustomerRecord}\r\n */\r\nfunction mapToCustomerRecord(businessInfo: ApplicationsBusinessInfo): CustomerRecord {\r\n const customerRecord = new CustomerRecord();\r\n customerRecord.businessInfo = businessInfo;\r\n return customerRecord;\r\n}\r\n\r\nexport async function encryptSensitiveData(value: string) {\r\n try {\r\n const response = await api.utilities.encrypt(value);\r\n if (response) {\r\n const last4: string = value.slice(-4);\r\n return {\r\n hashed: response.data.encryptedValue,\r\n last4: last4,\r\n };\r\n }\r\n } catch (error) {\r\n console.error(error);\r\n util.toastr(\"error\", \"Error\", \"Error saving. Please re-enter it and try again.\");\r\n }\r\n}\r\n\r\nexport const sendCodeToNewEmail = async (req: any) => {\r\n try {\r\n const response = await api.customerPortal.changeEmailRequest(req);\r\n if(response) {\r\n util.toastr(\"success\", \"Success\", \"Successfully sent. Please check your email.\")\r\n return response.data.payload;\r\n }\r\n } catch (error) {\r\n console.error(\"Error sending code\", error)\r\n util.toastr(\"error\", \"Error\", \"Error sending code. Please try again.\" )\r\n }\r\n}\r\n\r\nexport const sendCodeToNewPhone = async (req: any) => {\r\n try {\r\n const response = await api.customerPortal.changePhoneRequest(req);\r\n if(response) {\r\n util.toastr(\"success\", \"Success\", \"Successfully sent. Please check your phone.\")\r\n return response.data.payload;\r\n }\r\n } catch (error) {\r\n console.error(\"Error sending code\", error)\r\n util.toastr(\"error\", \"Error\", \"Error sending code. Please try again.\" )\r\n }\r\n}\r\n\r\nexport const verifyCodeToNewEmail = async (req: any) => {\r\n try {\r\n const response = await api.customerPortal.verifyNewEmailRequest(req);\r\n if(response?.data?.payload) {\r\n util.toastr(\"success\", \"Success\", \"Successfully verified!\")\r\n return response.data.payload;\r\n } else return util.toastr(\"error\", \"Error\", \"Error validating code. Please try again.\" )\r\n } catch (error) {\r\n console.error(\"Error sending code\", error)\r\n util.toastr(\"error\", \"Error\", \"Error validating code. Please try again.\" )\r\n return null;\r\n }\r\n}\r\n\r\nexport const verifyCodeToNewPhoneNumber = async (req: any) => {\r\n try {\r\n const response = await api.customerPortal.verifyNewPhoneRequest(req);\r\n if(response?.data.payload) {\r\n util.toastr(\"success\", \"Success\", \"Successfully verified!\")\r\n return response.data.payload;\r\n } else return util.toastr(\"error\", \"Error\", \"Error validating code. Please try again.\" )\r\n } catch (error) {\r\n console.error(\"Error sending code\", error)\r\n util.toastr(\"error\", \"Error\", \"Error validating code. Please try again.\" )\r\n return null;\r\n }\r\n}\r\n\r\n//#endregion\r\n\r\n//#region ---------- Widget stuff ------------ //\r\n\r\n/**\r\n * @param {Application} customerApp\r\n * @returns Either complete or incomplete, for the Credit App widget pill text\r\n */\r\nexport function getCreditAppPillLabel(customerApp: Application, language: string): string {\r\n if (!customerApp?.id) return \"\";\r\n if (hasCustomerApplication(null, customerApp) && isCreditApplicationComplete(null, customerApp)) {\r\n return language == \"English\" ? \"Completed\" : \"Completado\";\r\n }\r\n return language == \"English\" ? \"Incomplete\" : \"Incompletado\";\r\n}\r\n\r\nexport function getCreditAppPillStatusColor(customerApp: Application) {\r\n if (hasCustomerApplication(null, customerApp) && isCreditApplicationComplete(null, customerApp)) {\r\n return \"success\";\r\n }\r\n return \"error\"; // Assuming 'error' is the color code for incomplete\r\n}\r\n\r\nexport function disableCreditAppButton(customerApp: Application): boolean {\r\n if (!customerApp?.id) return true;\r\n return hasCustomerApplication(null, customerApp) && isCreditApplicationComplete(null, customerApp);\r\n}\r\n\r\n//#endregion\r\n\r\nexport function redirectToGarage(router: Router, id: string) {\r\n router.push({ name: \"garage\", query: { id } });\r\n}\r\n\r\nexport function rerouteHome(router: Router, id: string) {\r\n router.push({ name: \"home\", query: { id } });\r\n}\r\n\r\nexport function redirectToProfile(router: Router, id: string) {\r\n router.push({ name: \"profile\", query: { id } });\r\n}\r\n\r\nexport const redirectToBusinessPage = (router: Router, id: string | string[]) => {\r\n router.push({ name: \"business\", query: { id } });\r\n};\r\n\r\nexport const redirectToEditBusiness = (router: Router, id: string | string[]) => {\r\n router.push({ name: \"add-business\", query: { id } });\r\n};\r\n\r\nexport const redirectToAddVehiclePage = (router: Router, id: string | string[]) => {\r\n router.push({ name: \"add-vehicle\", query: { id } });\r\n};\r\n\r\nconst CustomerHelper = {\r\n rerouteHome,\r\n sendPortalLink,\r\n generateTinyUrl,\r\n getCustomerById,\r\n redirectToGarage,\r\n redirectToProfile,\r\n encryptSensitiveData,\r\n getCreditAppPillLabel,\r\n disableCreditAppButton,\r\n redirectToEditBusiness,\r\n redirectToBusinessPage,\r\n createBusinessCustomer,\r\n redirectToCustomerPortal,\r\n sendLinkToCustomerForPortal,\r\n getCustomerAndGenerateLink,\r\n getCreditAppPillStatusColor,\r\n getInformationForCustomerPortal,\r\n};\r\n\r\nexport default CustomerHelper;","import api from \"@core/services/api\";\r\nimport Application from \"@core/classes/Applications/Application\";\r\nimport { defineStore } from \"pinia\";\r\nimport { ref } from \"vue\";\r\n\r\nexport const useCustomerApplicationStore = defineStore(\"customerApplication\", () => {\r\n const customerApplication = ref(null);\r\n\r\n const getCustomerApplication = async (customerId: string) => {\r\n try {\r\n const customerAppData = await api.applications.getByCustomer(customerId);\r\n if (customerAppData?.status == 200 && customerAppData.data) {\r\n customerApplication.value = new Application(customerAppData.data);\r\n }\r\n } catch (error) {\r\n console.error(\"error\", error);\r\n }\r\n };\r\n const clearCustomerApplication = () => {\r\n customerApplication.value = new Application();\r\n };\r\n const setCustomerApplication = (newCustomerApplication: any) => {\r\n customerApplication.value = new Application(newCustomerApplication);\r\n };\r\n\r\n return {\r\n customerApplication,\r\n getCustomerApplication,\r\n clearCustomerApplication,\r\n setCustomerApplication,\r\n };\r\n});\r\n","import api from '@core/services/api'\r\nimport CustomerRecord from '@core/classes/Customer/CustomerRecord'\r\nimport { defineStore } from 'pinia'\r\nimport { ref } from 'vue'\r\n\r\nexport const useCustomerStore = defineStore('customer', () => {\r\n // State\r\n const customer = ref(null)\r\n\r\n // Actions\r\n async function getCustomer(customerId: string) {\r\n try {\r\n const response = await api.customerPortal.getCustomerInformation(customerId)\r\n if (response?.status === 200 && response.data) {\r\n customer.value = new CustomerRecord(response.data.customer)\r\n }\r\n } catch (error) {\r\n console.error(error, \"Error retrieving customer information\")\r\n clearCustomer()\r\n }\r\n }\r\n\r\n function clearCustomer() {\r\n customer.value = new CustomerRecord()\r\n }\r\n\r\n function setCustomer(newCustomer: any) {\r\n customer.value = new CustomerRecord(newCustomer)\r\n \r\n const customerPlainObject = JSON.parse(JSON.stringify(customer.value));\r\n localStorage.setItem('customerData', JSON.stringify(customerPlainObject));\r\n }\r\n\r\n return {\r\n customer,\r\n getCustomer,\r\n clearCustomer,\r\n setCustomer,\r\n }\r\n})\r\n","import Application from '@core/classes/Applications/Application';\r\nimport CustomerRecord from '@core/classes/Customer/CustomerRecord';\r\nimport { defineStore } from 'pinia';\r\nimport { getInformationForCustomerPortal } from '@core/helpers/Customer/customer-helper';\r\nimport LogRocket from 'logrocket';\r\nimport { ref } from 'vue';\r\nimport { useBusinessStore } from '@core/stores/BusinessStore';\r\nimport { useCustomerApplicationStore } from '@core/stores/CustomerApplicationStore';\r\nimport { useCustomerStore } from '@core/stores/CustomerStore';\r\n\r\nexport const useUserStore = defineStore('user', () => {\r\n const customerData = ref(null);\r\n const businessData = ref(null);\r\n const customerAppData = ref(null);\r\n const isInitialLoading = ref(false);\r\n\r\n\r\n // Action to set data in both UserStore and CustomerStore\r\n const setCustomerData = (customer: CustomerRecord) => {\r\n customerData.value = customer;\r\n const customerStore = useCustomerStore();\r\n customerStore.customer = customer;\r\n }\r\n\r\n // Action to set data in both UserStore and BusinessStore\r\n const setBusinessData = (business: any) => {\r\n businessData.value = business;\r\n const businessStore = useBusinessStore();\r\n businessStore.business = business;\r\n }\r\n\r\n // Action to set data in both UserStore and CustomerAppStore\r\n const setCustomerAppData = (customerApp: Application) => {\r\n customerAppData.value = customerApp;\r\n const customerAppStore = useCustomerApplicationStore();\r\n customerAppStore.customerApplication = customerApp;\r\n }\r\n\r\n const initializeCustomerData = async (customerId: string) => {\r\n if(customerId == null) return;\r\n if (customerData.value) {\r\n isInitialLoading.value = false;\r\n return;\r\n }\r\n\r\n try {\r\n isInitialLoading.value = true;\r\n const response = await getInformationForCustomerPortal(customerId);\r\n if (response) {\r\n setCustomerData(response.customer);\r\n setCustomerAppData(response.customerApplication);\r\n setBusinessData(response.businessCustomer);\r\n\r\n LogRocket.track(`Customer_Portal_Entered`, {\r\n customerId: response.customer?.id,\r\n customerCell: response.customer?.cell,\r\n customerEmail: response.customer?.email,\r\n customerDob: response.customer?.dob,\r\n applicationId: response.customerApplication?.id,\r\n businessCustomerId: response.businessCustomer?.id\r\n });\r\n }\r\n } catch (error) {\r\n LogRocket.error(\"Error loading customer data\", error)\r\n } finally {\r\n isInitialLoading.value = false;\r\n }\r\n }\r\n\r\n return {\r\n customerData,\r\n businessData,\r\n customerAppData,\r\n isInitialLoading,\r\n setCustomerData,\r\n setBusinessData,\r\n setCustomerAppData,\r\n initializeCustomerData\r\n };\r\n});\r\n","\r\n\r\n\r\n\r\n\r\n\r\n","\r\n\r\n\r\n\r\n","