text: /*! For license information please see cannlytics-1085f2fc4e59d59181bb.js.LICENSE.txt */
  var cannlytics;(()=>{var __webpack_modules__={"./console/assets/js/analyses/analyses.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"analyses\": () => (/* binding */ analyses)\n/* harmony export */ });\n/* harmony import */ var _api_api_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../api/api.js */ \"./console/assets/js/api/api.js\");\n/**\r\n * Analysis JavaScript | Cannlytics Console\r\n * Author: Keegan Skeate\r\n * Created: 12/3/2020\r\n * Updated: 6/12/2021\r\n */\n// import Chart from 'chart.js';\n// import \"chartjs-chart-box-and-violin-plot/build/Chart.BoxPlot.js\";\n\n\nfunction randomValues(count, min, max) {\n  var delta = max - min;\n  return Array.from({\n    length: count\n  }).map(() => Math.random() * delta + min);\n}\n\nvar analyses = {\n  initialize() {\n    console.log('TODO: Initialize analyses...!'); // this.drawGraphs();\n  },\n\n  drawAnalysesTable() {\n    /*\r\n     * Render the analyses table.\r\n     */\n    var columnDefs = [{\n      field: 'name',\n      sortable: true,\n      filter: true\n    }, {\n      field: 'email',\n      sortable: true,\n      filter: true\n    }, {\n      field: 'phone',\n      sortable: true,\n      filter: true\n    }]; // Specify the table options.\n    // const gridOptions = {\n    //   columnDefs: columnDefs,\n    //   pagination: true,\n    //   rowSelection: 'multiple',\n    //   suppressRowClickSelection: false,\n    //   // singleClickEdit: true,\n    //   // onRowClicked: event => console.log('A row was clicked'),\n    //   onGridReady: event => theme.toggleTheme(theme.getTheme()),\n    // };\n    // Get the data and render the table.\n    // api.getOrganizations().then((data) => {\n    //   console.log('Table data:', data); // DEV:\n    //   const eGridDiv = document.querySelector(`#${tableId}`);\n    //   new agGrid.Grid(eGridDiv, gridOptions);\n    //   gridOptions.api.setRowData(data);\n    // })\n    // .catch((error) => {\n    //   console.log('Error:', error);\n    // });\n    // TODO: Attach export functionality\n    //function exportTableData() {\n    //  gridOptions.api.exportDataAsCsv();\n    //}\n  },\n\n  drawGraphs() {\n    var ctx = document.getElementById('graph-concentrations');\n    var graph = new Chart(ctx, {\n      type: 'boxplot',\n      data: this.data,\n      options: {\n        responsive: true,\n        legend: {\n          position: 'bottom'\n        }\n      }\n    });\n  },\n\n  data: {\n    // TODO: Get from Firestore\n    // define label tree\n    labels: ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'],\n    datasets: [{\n      label: 'Flower',\n      backgroundColor: 'rgba(255, 0, 0, 0.5)',\n      borderColor: 'red',\n      borderWidth: 1,\n      outlierColor: '#999999',\n      padding: 10,\n      itemRadius: 0,\n      data: [randomValues(100, 0, 100), randomValues(100, 0, 20), randomValues(100, 20, 70), randomValues(100, 60, 100), randomValues(40, 50, 100), randomValues(100, 60, 120), randomValues(100, 80, 100)]\n    }, {\n      label: 'Concentrates',\n      backgroundColor: 'rgba(0, 0, 255, 0.5)',\n      borderColor: 'blue',\n      borderWidth: 1,\n      outlierColor: '#999999',\n      padding: 10,\n      itemRadius: 0,\n      data: [randomValues(100, 60, 100), randomValues(100, 0, 100), randomValues(100, 0, 20), randomValues(100, 20, 70), randomValues(40, 60, 120), randomValues(100, 20, 100), randomValues(100, 80, 100)]\n    }]\n  },\n\n  getAnalyses() {\n    /*\r\n     * Get all analyses for an organization.\r\n     */\n    // TODO: Get the data and fill it into an AG Grid table!\n    _api_api_js__WEBPACK_IMPORTED_MODULE_0__.api.getAnalyses(data);\n  },\n\n  saveAnalysis() {\n    /*\r\n     * Create or update an analysis.\r\n     */\n    // TODO: Serialize the analysis data!\n    var data = {};\n    _api_api_js__WEBPACK_IMPORTED_MODULE_0__.api.createAnalyses(data);\n  },\n\n  deleteAnalysis() {\n    /*\r\n     * Delete an analysis.\r\n     */\n    // TODO: Serialize the analysis data!\n    var data = {};\n    _api_api_js__WEBPACK_IMPORTED_MODULE_0__.api.createAnalyses(data);\n  },\n\n  exportAnalyses() {\n    /*\r\n     * Export all Analyses to Excel.\r\n     */\n    // TODO: Serialize the analysis data!\n    var data = {};\n    _api_api_js__WEBPACK_IMPORTED_MODULE_0__.api.createAnalyses(data);\n  },\n\n  importAnalyses() {\n    /*\r\n     * Import a data file (.csv or .xlsx) of data.\r\n     */\n    // TODO:\n  },\n\n  exportAnalytes() {\n    /*\r\n     * Export all data to Excel.\r\n     */\n    // TODO: Serialize the analysis data!\n    var data = {};\n    _api_api_js__WEBPACK_IMPORTED_MODULE_0__.api.createAnalyses(data);\n  },\n\n  importAnalytes() {\n    /*\r\n     * Import a data file (.csv or .xlsx) of data.\r\n     */\n    // TODO:\n  }\n\n};\n\n//# sourceURL=webpack://cannlytics/./console/assets/js/analyses/analyses.js?")},"./console/assets/js/api/api.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"api\": () => (/* binding */ api)\n/* harmony export */ });\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils.js */ \"./console/assets/js/utils.js\");\n/**\r\n * API Interface | Cannlytics Console\r\n * Author: Keegan Skeate\r\n * Created: 4/24/2021\r\n * Updated: 6/21/2021\r\n * Description: The `api` object interfaces with the Cannlytics API to send\r\n * and retrieve data to and from the back-end, where data is processed and\r\n * stored in the Firestore database and Metrc API.\r\n */\n\nvar api = {\n  /*----------------------------------------------------------------------------\r\n  General create, read, update, and delete (C.R.U.D.)\r\n  ----------------------------------------------------------------------------*/\n  get(model) {\n    var id = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n    var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n    /* Retrieve data from the database, either an array of data objects or a\r\n    single object if an ID is specified. Pass params in options to filter the data. */\n    var modelType = model.replace(/^./, string[0].toUpperCase());\n    if (id) return (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)(\"/api/\".concat(model, \"/\").concat(id));\n    return (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)(\"/api/\".concat(model), null, options);\n  },\n\n  delete(model) {\n    var id = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n\n    /* Delete an entry from the database, passing the whole object\r\n    as context if available in a form, otherwise just pass the ID. */\n    if (id) return (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)(\"/api/\".concat(model, \"/\").concat(id), null, {\n      delete: true\n    });\n    var form = document.getElementById(\"\".concat(model, \"-form\"));\n    var data = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.formDeserialize)(form);\n    return (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)(\"/api/\".concat(model), data, {\n      delete: true\n    });\n  },\n\n  save(model, id) {\n    /* Create an entry in the database if it does not exist,\r\n    otherwise update the entry. */\n    var form = document.getElementById(\"\".concat(model, \"-form\"));\n    var data = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.formDeserialize)(form);\n    console.log('TODO: save data:', data);\n    return (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)(\"/api/\".concat(model, \"/\").concat(id), data);\n  },\n\n  create(model) {\n    /* Create an entry in the database. (Redundant?) */\n    return this.save(model);\n  },\n\n  update() {\n    /* Update an entry in the database. (Redundant?) */\n    return this.save(model);\n  },\n\n  /* TODO: REMOVE ANYTHING UNUSED BELOW */\n\n  /*----------------------------------------------------------------------------\r\n  Analyses\r\n  ----------------------------------------------------------------------------*/\n  getAnalysis: id => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)(\"/api/analyses/\".concat(id)),\n  getAnalyses: params => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/api/analyses', null, {\n    params\n  }),\n  createAnalyses: data => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/api/analyses', data),\n  updateAnalyses: data => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/api/analyses', data),\n  deleteAnalyses: data => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/api/analyses', data, {\n    delete: true\n  }),\n\n  /*----------------------------------------------------------------------------\r\n  Analytes\r\n  ----------------------------------------------------------------------------*/\n  getAnalyte: id => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)(\"/api/analytes/\".concat(id)),\n  getAnalytes: params => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/api/analytes', null, {\n    params\n  }),\n  createAnalytes: data => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/api/analytes', data),\n  updateAnalytes: data => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/api/analytes', data),\n  deleteAnalytes: data => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/api/analytes', data, {\n    delete: true\n  }),\n\n  /*----------------------------------------------------------------------------\r\n  Areas\r\n  ----------------------------------------------------------------------------*/\n  getArea: id => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)(\"/api/areas/\".concat(id)),\n  getAreas: params => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/api/areas', null, {\n    params\n  }),\n  createAreas: data => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/api/areas', data),\n  updateAreas: data => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/api/areas', data),\n  deleteAreas: data => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/api/areas', data, {\n    delete: true\n  }),\n\n  /*----------------------------------------------------------------------------\r\n  Contacts\r\n  ----------------------------------------------------------------------------*/\n  getContact: id => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)(\"/api/contacts/\".concat(id)),\n  getContacts: params => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/api/contacts', null, {\n    params\n  }),\n  createContacts: data => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/api/contacts', data),\n  updateContacts: data => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/api/contacts', data),\n  deleteContacts: data => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/api/contacts', data, {\n    delete: true\n  }),\n  // Contact contacts.\n  getContactPeople: orgId => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)(\"/api/contacts/\".concat(orgId, \"/people\")),\n  createContactPeople: (orgId, data) => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)(\"/api/contacts/\".concat(orgId, \"/people\"), data),\n  updateContactPeople: (orgId, data) => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)(\"/api/contacts/\".concat(orgId, \"/people\"), data),\n  deleteContactPeople: (orgId, data) => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)(\"/api/contacts/\".concat(orgId, \"/people\"), data, {\n    delete: true\n  }),\n\n  /*----------------------------------------------------------------------------\r\n  Inventory\r\n  ----------------------------------------------------------------------------*/\n  getItem: id => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)(\"/api/inventory/\".concat(id)),\n  getInventory: params => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/api/inventory', null, {\n    params\n  }),\n  createInventory: data => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/api/inventory', data),\n  updateInventory: data => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/api/inventory', data),\n  deleteInventory: data => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/api/inventory', data, {\n    delete: true\n  }),\n\n  /*----------------------------------------------------------------------------\r\n  Instruments\r\n  ----------------------------------------------------------------------------*/\n  getInstrument: id => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)(\"/api/instruments/\".concat(id)),\n  getInstruments: params => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/api/instruments', null, {\n    params\n  }),\n  createInstruments: data => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/api/instruments', data),\n  updateInstruments: data => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/api/instruments', data),\n  deleteInstruments: data => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/api/instruments', data, {\n    delete: true\n  }),\n\n  /*----------------------------------------------------------------------------\r\n  Invoices\r\n  ----------------------------------------------------------------------------*/\n  getInvoice: id => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)(\"/api/invoices/\".concat(id)),\n  getInvoices: params => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/api/invoices', null, {\n    params\n  }),\n  createInvoices: data => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/api/invoices', data),\n  updateInvoices: data => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/api/invoices', data),\n  deleteInvoices: data => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/api/invoices', data, {\n    delete: true\n  }),\n\n  /*----------------------------------------------------------------------------\r\n  Users (Mesh with staff/team/contacts)\r\n  ----------------------------------------------------------------------------*/\n  getUser: id => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)(\"/api/users/\".concat(id)),\n  getUsers: params => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/api/users', null, {\n    params\n  }),\n  createUser: data => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/api/users', data),\n  updateUser: data => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/api/users', data),\n  deleteUser: data => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/api/users', data, {\n    delete: true\n  }),\n  // User settings.\n  getUserSettings: userId => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)(\"/api/users/\".concat(userId, \"/settings\")),\n  updateUserSettings: (userId, data) => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)(\"/api/users/\".concat(userId, \"/settings\"), data),\n\n  /*----------------------------------------------------------------------------\r\n  Organizations (Mesh with facilities)\r\n  ----------------------------------------------------------------------------*/\n  getOrganization: id => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)(\"/api/organizations/\".concat(id)),\n  getOrganizations: params => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/api/organizations', null, {\n    params\n  }),\n  createOrganizations: data => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/api/organizations', data),\n  updateOrganizations: data => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/api/organizations', data),\n  deleteOrganizations: data => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/api/organizations', data, {\n    delete: true\n  }),\n  // Organization settings.\n  getOrganizationSettings: orgId => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)(\"/api/organizations/\".concat(orgId, \"/settings\")),\n  updateOrganizationSettings: (orgId, data) => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)(\"/api/organizations/\".concat(orgId, \"/settings\"), data),\n\n  /*----------------------------------------------------------------------------\r\n  Transfers\r\n  ----------------------------------------------------------------------------*/\n  getMeasurement: id => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)(\"/api/measurements/\".concat(id)),\n  getMeasurements: params => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/api/measurements', null, {\n    params\n  }),\n  createMeasurements: data => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/api/measurements', data),\n  updateMeasurements: data => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/api/measurements', data),\n  deleteMeasurements: data => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/api/measurements', data, {\n    delete: true\n  }),\n\n  /*----------------------------------------------------------------------------\r\n  Projects\r\n  ----------------------------------------------------------------------------*/\n  getProject: id => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)(\"/api/projects/\".concat(id)),\n  getProjects: params => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/api/projects', null, {\n    params\n  }),\n  createProjects: data => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/api/projects', data),\n  updateProjects: data => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/api/projects', data),\n  deleteProjects: data => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/api/projects', data, {\n    delete: true\n  }),\n\n  /*----------------------------------------------------------------------------\r\n  Results\r\n  ----------------------------------------------------------------------------*/\n  getResult: id => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)(\"/api/results/\".concat(id)),\n  getResults: params => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/api/results', null, {\n    params\n  }),\n  createResults: data => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/api/results', data),\n  updateResults: data => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/api/results', data),\n  deleteResults: data => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/api/results', data, {\n    delete: true\n  }),\n\n  /*----------------------------------------------------------------------------\r\n  Samples\r\n  ----------------------------------------------------------------------------*/\n  getSample: id => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)(\"/api/samples/\".concat(id)),\n  getSamples: params => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/api/samples', null, {\n    params\n  }),\n  createSamples: data => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/api/samples', data),\n  updateSamples: data => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/api/samples', data),\n  deleteSamples: data => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/api/samples', data, {\n    delete: true\n  }),\n\n  /*----------------------------------------------------------------------------\r\n  Transfers\r\n  ----------------------------------------------------------------------------*/\n  getTransfer: id => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)(\"/api/transfers/\".concat(id)),\n  getTransfers: params => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/api/transfers', null, {\n    params\n  }),\n  createTransfers: data => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/api/transfers', data),\n  updateTransfers: data => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/api/transfers', data),\n  deleteTransfers: data => (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/api/transfers', data, {\n    delete: true\n  })\n};\n\n//# sourceURL=webpack://cannlytics/./console/assets/js/api/api.js?")},"./console/assets/js/app/app.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"app\": () => (/* binding */ app)\n/* harmony export */ });\n/**\r\n * App JavaScript | Cannlytics Console\r\n * Author: Keegan Skeate <contact@cannlytics.com>\r\n * Created: 12/7/2020\r\n * Updated: 6/23/2021\r\n */\nvar app = {\n  initialize() {\n    /*\r\n    * Initialize the console.\r\n    */\n    // auth.onAuthStateChanged((user) => {\n    //   console.log('Detected user:', user)\n    //   if (user) {\n    //     // initializeUserUI(user);\n    //     // authRequest('/api/auth/authenticate');\n    //     // TODO: Get user's organizations from Firestore through the API!\n    //     // console.log('Getting user organizations...');\n    //     // authRequest('/api/organizations').then((data) => {\n    //     //   console.log('User organizations:', data);\n    //     // });\n    //     // FIXME: Hot-fix to reload page if sidebar is prompting login.\n    //     // const signInMenu = document.getElementById('sidebar-menu-login');\n    //     // if (signInMenu) location.reload();\n    //   }\n    // });\n    // Enable any and all tooltips.\n    var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle=\"tooltip\"]'));\n    tooltipTriggerList.map(tooltipTriggerEl => new bootstrap.Tooltip(tooltipTriggerEl));\n  },\n\n  search() {\n    /*\r\n     * General search function to query the entire app and return the most\r\n     * relevant page.\r\n     */\n    console.log('Searching...');\n    var searchTerms = document.getElementById('navigation-search').value; // const urlParams = new URLSearchParams(window.location.search);\n    // urlParams.set('q', searchTerms);\n    // window.location.search = urlParams;\n    // window.location.href = '/search';\n\n    setGetParameter('q', searchTerms); // const query = URLSearchParams(window.location.search).get('q');\n    // console.log(query);\n  }\n\n};\n\nfunction setGetParameter(paramName, paramValue) {\n  var url = window.location.href;\n  var hash = location.hash;\n  url = url.replace(hash, '');\n\n  if (url.indexOf(paramName + \"=\") >= 0) {\n    var prefix = url.substring(0, url.indexOf(paramName + \"=\"));\n    var suffix = url.substring(url.indexOf(paramName + \"=\"));\n    suffix = suffix.substring(suffix.indexOf(\"=\") + 1);\n    suffix = suffix.indexOf(\"&\") >= 0 ? suffix.substring(suffix.indexOf(\"&\")) : \"\";\n    url = prefix + paramName + \"=\" + paramValue + suffix;\n  } else {\n    if (url.indexOf(\"?\") < 0) url += \"?\" + paramName + \"=\" + paramValue;else url += \"&\" + paramName + \"=\" + paramValue;\n  }\n\n  window.location.href = \"\\\\search\\\\\".concat(url).concat(hash);\n} // function initializeUserUI(user) {\n//   /*\n//    * Setup user's UI based on their preferences and claims.\n//    */\n//   const organization = user.organization || 'Cannlytics';\n//   const navPhoto = document.getElementById('userPhotoNav');\n//   const menuPhoto = document.getElementById('userPhotoMenu');\n//   if (user.photoURL) {\n//     navPhoto.src = user.photoURL;\n//     menuPhoto.src = user.photoURL;\n//   }\n//   else {\n//     const robohash = `https://robohash.org/${user.email}?set=set5`;\n//     navPhoto.src = robohash;\n//     menuPhoto.src = robohash;\n//   }\n//   document.getElementById('anonymous-signup').classList.add('d-none');\n//   document.getElementById('userEmail').textContent = user.email;\n//   document.getElementById('userName').textContent = user.displayName;\n//   // TODO: Show Personalize your account button\n//   if (!user.displayName) {\n//     document.getElementById('personalize-account').classList.remove('d-none');\n//   }\n//   document.title = `${document.title.split('|')[0]} | ${organization}`;\n//   if (document.title.startsWith('|')) document.title = `Dashboard ${document.title}`;\n// }\n\n//# sourceURL=webpack://cannlytics/./console/assets/js/app/app.js?")},"./console/assets/js/auth/auth.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"auth\": () => (/* binding */ auth)\n/* harmony export */ });\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils.js */ \"./console/assets/js/utils.js\");\n/**\r\n * Authentication JavaScript | Cannlytics Console\r\n * Author: Keegan Skeate\r\n * Created: 12/4/2020\r\n * Updated: 6/23/2021\r\n */\n\nvar auth = {\n  currentUser() {\n    return firebase.auth().currentUser;\n  },\n\n  anonymousSignIn() {\n    /*\r\n     * Anonymously sign-in a user.\r\n     */\n    return new Promise((resolve, reject) => {\n      firebase.auth().signInAnonymously().then(() => {\n        resolve();\n      }).catch(error => {\n        reject(error);\n      });\n    });\n  },\n\n  googleSignIn() {\n    /*\r\n     * Sign in a user with Google.\r\n     */\n    var provider = new firebase.auth.GoogleAuthProvider();\n    firebase.auth().signInWithRedirect(provider);\n  },\n\n  googleSignInRedirect() {\n    /*\r\n     * Signs in a user after a successful Google sign-in redirect.\r\n     */\n    // FIXME: Login on redirect does not work\n    console.log('Checking for Google redirect...');\n    firebase.auth().getRedirectResult().then(result => {\n      if (result.credential) {// This gives you a Google Access Token. You can use it to access the Google API.\n        // var token = result.credential.accessToken;\n        // window.location.href = '/';\n      } // The signed-in user info.\n\n\n      var user = result.user;\n      console.log('User:', user);\n    }).catch(error => {\n      // Handle Errors here.\n      var errorCode = error.code;\n      var errorMessage = error.message; // The email of the user's account used.\n\n      var email = error.email; // The firebase.auth.AuthCredential type that was used.\n\n      var credential = error.credential; // ...\n\n      console.log('Error:', errorMessage);\n    });\n  },\n\n  resetPassword() {\n    /*\r\n     * Reset a user's password.\r\n     */\n    var auth = firebase.auth();\n    var email = document.getElementById('login-email').value;\n    auth.sendPasswordResetEmail(email).then(function () {\n      window.location.href = '/account/password-reset-done';\n    }).catch(function (error) {\n      (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.showNotification)('Reset password error', error.message, {\n        type: 'error'\n      });\n    });\n  },\n\n  resetPasswordCodeCheck() {\n    /*\r\n     * Check if the password reset code is valid.\r\n     */\n    var url = new URL(window.location.href);\n    var code = url.searchParams.get('oobCode');\n    firebase.auth().verifyPasswordResetCode(code).then(email => {\n      document.getElementById('user-email').value = email;\n    }).catch(() => {\n      var invalidMessage = document.getElementById('password-reset-code-invalid-message');\n      var passwordResetForm = document.getElementById('password-reset-form');\n      passwordResetForm.classList.add('d-none');\n      invalidMessage.classList.remove('d-none');\n    });\n  },\n\n  resetPasswordConfirm() {\n    /*\r\n     * Confirm a password reset.\r\n     */\n    var newPassword = document.getElementById('login-password').value;\n    var newPasswordConfirmation = document.getElementById('login-password-confirmation').value;\n\n    if (newPassword !== newPasswordConfirmation) {\n      var message = 'The passwords you entered are not the same, please confirm your password.';\n      (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.showNotification)('Passwords do not match', message, {\n        type: 'error'\n      });\n      return;\n    }\n\n    firebase.auth().confirmPasswordReset(code, newPassword).then(() => {\n      window.location.href = '/account/password-reset-complete';\n    }).catch(() => {\n      var message = 'The password reset link that you used is invalid. Please request a new password reset link.';\n      (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.showNotification)('Password reset error', message, {\n        type: 'error'\n      });\n    });\n  },\n\n  signIn(event) {\n    /*\r\n     * Sign in a user.\r\n     */\n    event.preventDefault();\n    var email = document.getElementById('login-email').value;\n    var password = document.getElementById('login-password').value;\n    document.getElementById('sign-in-button').classList.add('d-none');\n    document.getElementById('sign-in-loading-button').classList.remove('d-none');\n    firebase.auth().signInWithEmailAndPassword(email, password).then(user => {\n      // Optional: Handle error more elegantly.\n      return (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/login').then(response => {\n        window.location.href = window.location.origin;\n      }).catch(error => {\n        window.location.href = window.location.origin;\n      });\n    }) // Optional: Determine if it's okay to stay signed in.\n    // The Firestore docs show to sign out when using session cookies,\n    // but this means that all requests to Firestore have to go through the API.\n    // It is still nice to be able to interact with Firestore from client-side JavaScript.\n    // .then(() => {\n    //   // return firebase.auth().signOut();\n    // }).then(() => {\n    //   // window.location.href = window.location.origin;\n    //   // window.location.assign('/');\n    // })\n    .catch(error => {\n      (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.showNotification)('Sign in error', error.message, {\n        type: 'error'\n      });\n    }).finally(() => {\n      document.getElementById('sign-in-button').classList.remove('d-none');\n      document.getElementById('sign-in-loading-button').classList.add('d-none');\n    });\n  },\n\n  signUp() {\n    /*\r\n     * Sign up a user.\r\n     */\n    var terms = document.getElementById('login-terms-accepted');\n\n    if (!terms.checked) {\n      var message = 'Please agree with our terms of service and read our privacy policy to create an account.';\n      (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.showNotification)('Terms not accepted', message, {\n        type: 'error'\n      });\n      terms.classList.add('is-invalid');\n      return;\n    } else {\n      terms.classList.remove('is-invalid');\n    }\n\n    var email = document.getElementById('login-email').value;\n    var password = document.getElementById('login-password').value;\n    document.getElementById('sign-up-button').classList.add('d-none');\n    document.getElementById('sign-up-loading-button').classList.remove('d-none'); // FIXME: Ensure sign-up works with user sessions.\n\n    firebase.auth().createUserWithEmailAndPassword(email, password).then(() => {\n      // Optional: Handle error more elegantly.\n      return (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/login').then(response => {\n        this.postSignUp();\n      }).catch(error => {\n        this.postSignUp();\n      });\n    }) // .then(() => {\n    //   apiRequest('/api/users', { email, photo_url: `https://robohash.org/${email}?set=set5` })\n    //       .then(() => {\n    //         window.location.href = window.location.origin;\n    //       })\n    //   // Optional: Implement user verification and don't send emails in development.\n    //   // this.verifyUser();\n    // })\n    .catch(error => {\n      (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.showNotification)('Sign up error', error.message, {\n        type: 'error'\n      });\n    }).finally(() => {\n      document.getElementById('sign-up-button').classList.remove('d-none');\n      document.getElementById('sign-up-loading-button').classList.add('d-none');\n    });\n    ;\n  },\n\n  postSignUp() {\n    /*\r\n     * Post sign-up routine.\r\n     */\n    var data = {\n      email,\n      photo_url: \"https://robohash.org/\".concat(email, \"?set=set5\")\n    };\n    (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.apiRequest)('/api/users', data).then(() => {\n      window.location.href = window.location.origin;\n    });\n  },\n\n  signOut() {\n    /*\r\n    * Sign a user out of Firebase and clear the session.\r\n    */\n    var baseURL = window.location.origin;\n    (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/logout').then(response => {\n      document.location.href = \"\".concat(baseURL, \"/account/sign-out\");\n    }).catch(error => {\n      document.location.href = \"\".concat(baseURL, \"/account/sign-out\");\n    });\n  },\n\n  verifyUser() {\n    /*\r\n     * Send a user a verification email.\r\n     */\n    var user = firebase.auth().currentUser;\n    user.sendEmailVerification().then(() => {\n      (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.showNotification)('Verification email sent', error.message, {\n        type: 'success'\n      });\n    }).catch(function (error) {\n      console.log(error);\n      (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.showNotification)('Verification error', error.message, {\n        type: 'error'\n      });\n    });\n  }\n\n};\n\n//# sourceURL=webpack://cannlytics/./console/assets/js/auth/auth.js?")},"./console/assets/js/dashboard/dashboard.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"dashboard\": () => (/* binding */ dashboard)\n/* harmony export */ });\n/* harmony import */ var _firebase_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../firebase.js */ \"./console/assets/js/firebase.js\");\n/* harmony import */ var _firebase_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_firebase_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils.js */ \"./console/assets/js/utils.js\");\n/**\r\n * Dashboard JavaScript | Cannlytics Console\r\n * Author: Keegan Skeate <keegan@cannlytics.com>\r\n * Created: 12/3/2020\r\n * Updated: 6/21/2021\r\n */\n\n\nvar dashboard = {\n  initializeGetStarted(stage) {\n    /*\r\n     * Initializes the get started forms.\r\n     */\n    // Optional: Initialize authentication from the back-end?\n    _firebase_js__WEBPACK_IMPORTED_MODULE_0__.auth.onAuthStateChanged(user => {\n      if (user) {\n        if (stage === 'profile') {\n          // initializeGetStartedProfileUI(user)\n          (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.authRequest)('/api/users').then(data => initializeGetStartedProfileUI(data));\n        } else if (stage === 'organization') {\n          initializeGetStartedOrganizationUI({});\n        }\n      }\n    });\n  },\n\n  joinOrganizationRequest() {\n    /*\r\n     * Send the owner of an organization a request for a user to join.\r\n     */\n    var organization = document.getElementById('join-organization-input').value;\n\n    if (!organization) {\n      (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.showNotification)('Organization required', 'Enter an organization name.', {\n        type: 'error'\n      });\n      return;\n    }\n\n    (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.authRequest)('/api/organizations/join', {\n      organization,\n      join: true\n    }).then(response => {\n      if (response.success) {\n        (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.showNotification)('Organization request sent', response.message, {\n          type: 'success'\n        });\n      } else {\n        (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.showNotification)('Organization request failed', response.message, {\n          type: 'error'\n        });\n      }\n    });\n  },\n\n  selectSupportTier(tier) {\n    /*\r\n     * Add selected indicator to support choices.\r\n     */\n    var cards = document.getElementsByClassName('support-card');\n\n    for (var i = 0; i < cards.length; i++) {\n      cards[i].classList.remove('border-success', 'shadow');\n\n      if (cards[i].id === \"tier\".concat(tier)) {\n        cards[i].classList.add('border-success', 'shadow');\n      }\n    }\n  },\n\n  saveOrganization(orgType) {\n    /*\r\n     * Save's a user's organization choice.\r\n     */\n    var elements = document.getElementById('create-organization-form').elements;\n    var data = {};\n\n    for (var i = 0; i < elements.length; i++) {\n      var item = elements.item(i);\n      if (item.name) data[item.name] = item.value;\n    }\n\n    var orgId = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.slugify)(data['name']);\n    (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.authRequest)(\"/api/organizations\", data).then(response => {\n      // Optional: Show better error messages.\n      // Optional: Tell user if organization name is already taken\n      if (response.error) {\n        (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.showNotification)('Organization request failed', response.message, {\n          type: 'error'\n        });\n      } else {\n        // Optional: Navigate straight to the dash if the user requested to join an organization.\n        // showNotification('Organization request sent', response.message, { type: 'success' });\n        document.location.href = \"/get-started/support/?from=\".concat(orgType);\n      }\n    });\n  },\n\n  saveUserData(type) {\n    /*\r\n     * Save's a user's data.\r\n     */\n    var user = _firebase_js__WEBPACK_IMPORTED_MODULE_0__.auth.currentUser;\n    var data = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.serializeForm)('user-form');\n    var baseURL = window.location.origin;\n    data.type = type;\n\n    if (user === null) {\n      signUp(data.email).then(() => {\n        document.location.href = \"\".concat(baseURL, \"/get-started/organization/?from=\").concat(type);\n      }).catch(error => {\n        (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.showNotification)('Sign up error', error.message, {\n          type: 'error'\n        }); // Optional: Show error class (.is-invalid) if invalid\n      });\n    } else {\n      if (data.email !== user.email) {\n        user.updateEmail(data.email);\n      }\n\n      if (data.name !== user.displayName) {\n        user.updateProfile({\n          displayName: data.name\n        });\n      }\n\n      (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.authRequest)('/api/users', data).then(() => {\n        document.location.href = \"\".concat(baseURL, \"/get-started/organization/?from=\").concat(type);\n      });\n    }\n  },\n\n  saveSupport() {\n    /*\r\n     * Save's a user's support option.\r\n     */\n    var tier = 'Free';\n    var cards = document.getElementsByClassName('support-card');\n\n    for (var i = 0; i < cards.length; i++) {\n      if ((0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.hasClass)(cards[i], 'border-success')) {\n        tier = cards[i].id.replace('tier', '');\n      }\n    }\n\n    (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.authRequest)('/api/users', {\n      support: tier\n    }).then(() => {\n      document.location.href = '/';\n    });\n  },\n\n  showOrganizationForm(type) {\n    /*\r\n     * Show either the join or create organization forms or neither.\r\n     */\n    document.getElementById('organization-choice').classList.add('d-none');\n    document.getElementById('cancel-organization-choice').classList.remove('d-none');\n\n    if (type === 'join') {\n      document.getElementById('join-organization-form').classList.remove('d-none');\n    } else if (type === 'create') {\n      document.getElementById('create-organization-form').classList.remove('d-none');\n    } else {\n      document.getElementById('join-organization-form').classList.add('d-none');\n      document.getElementById('create-organization-form').classList.add('d-none');\n      document.getElementById('organization-choice').classList.remove('d-none');\n      document.getElementById('cancel-organization-choice').classList.add('d-none');\n    }\n  },\n\n  choosePhoto() {\n    /*\r\n     * Choose a file to upload.\r\n     */\n    var fileSelect = document.getElementById('selectPhotoUrl');\n    fileSelect.click();\n  }\n\n};\n/*\r\n * Internal Functions\r\n */\n\nfunction signUp(email) {\n  /*\r\n   * Sign up a user.\r\n   */\n  return new Promise((resolve, reject) => {\n    var password = _utils_js__WEBPACK_IMPORTED_MODULE_1__.Password.generate(32);\n    firebase.auth().createUserWithEmailAndPassword(email, password).then(() => {\n      (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.authRequest)('/api/users', {\n        email,\n        photo_url: \"https://robohash.org/\".concat(email, \"?set=set5\")\n      }).then(data => {\n        resolve(data);\n      }).catch(error => {\n        reject(error);\n      });\n    }).catch(error => {\n      reject(error);\n    });\n  }); // var termsAccepted = document.getElementById('login-terms-accepted').checked;\n  // if (!termsAccepted) {\n  //   showError(\n  //     'Terms not accepted',\n  //     'Please agree with our terms of service and read our privacy policy to create an account.'\n  //   );\n  //   return;\n  // }\n  // var password = document.getElementById('login-password').value;\n} // Moved to settings/user.js\n\n\nfunction uploadUserPhoto() {\n  /*\r\n   * Upload a user's photo through the API.\r\n   */\n  if (this.files.length) {\n    (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.showNotification)('Uploading photo', 'Uploading your profile picture...', {\n      type: 'wait'\n    });\n    (0,_firebase_js__WEBPACK_IMPORTED_MODULE_0__.changePhotoURL)(this.files[0]).then(downloadURL => {\n      (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.authRequest)('/api/users', {\n        photo_url: downloadURL\n      });\n      document.getElementById('user-photo-url').src = downloadURL;\n      document.getElementById('userPhotoNav').src = downloadURL;\n      document.getElementById('userPhotoMenu').src = downloadURL;\n      (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.showNotification)('Uploading photo complete', 'Successfully uploaded your profile picture.', {\n        type: 'success'\n      });\n    }).catch(error => {\n      (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.showNotification)('Photo Change Error', _firebase_js__WEBPACK_IMPORTED_MODULE_0__.storageErrors[error.code], {\n        type: 'error'\n      });\n    });\n  }\n}\n\nfunction uploadOrgPhoto(orgId) {\n  /*\r\n   * Upload a photo for an organization through the API.\r\n   */\n  if (this.files.length) {\n    (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.showNotification)('Uploading photo', 'Uploading your organization picture...', {\n      type: 'wait'\n    });\n    (0,_firebase_js__WEBPACK_IMPORTED_MODULE_0__.changePhotoURL)(this.files[0]).then(downloadURL => {\n      (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.authRequest)('/api/organizations', {\n        photo_url: downloadURL,\n        uid: orgId\n      });\n      document.getElementById('org-photo-url').src = downloadURL;\n      (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.showNotification)('Uploading photo complete', 'Successfully uploaded organization picture.', {\n        type: 'success'\n      });\n    }).catch(error => {\n      (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.showNotification)('Photo Change Error', _firebase_js__WEBPACK_IMPORTED_MODULE_0__.storageErrors[error.code], {\n        type: 'error'\n      });\n    });\n  }\n}\n/*\r\n * UI Management\r\n */\n\n\nfunction initializeGetStartedProfileUI(data) {\n  /*\r\n   * Initialize the get-started profile section's form with existing values.\r\n   */\n  // Populate the form's fields.\n  var form = document.getElementById('user-form');\n  var {\n    elements\n  } = form;\n\n  for (var [key, value] of Object.entries(data)) {\n    var field = elements.namedItem(key);\n    console.log(key, field);\n\n    try {\n      field && (field.value = value);\n    } catch (error) {}\n  } // Attach functionality.\n\n\n  var fileElem = document.getElementById('userPhotoUrl');\n  fileElem.addEventListener('change', uploadUserPhoto, false);\n}\n\nfunction initializeGetStartedOrganizationUI(data) {\n  /*\r\n   * Initialize the get-started organization section.\r\n   */\n  // Attach functionality.\n  var fileElem = document.getElementById('selectPhotoUrl');\n  fileElem.addEventListener('change', uploadOrgPhoto, false);\n}\n\n//# sourceURL=webpack://cannlytics/./console/assets/js/dashboard/dashboard.js?")},"./console/assets/js/firebase.js":()=>{eval("throw new Error(\"Module build failed (from ./node_modules/babel-loader/lib/index.js):\\nSyntaxError: C:\\\\Users\\\\keega\\\\Documents\\\\cannlytics\\\\cannlytics\\\\console\\\\assets\\\\js\\\\firebase.js: Export 'signOut' is not defined (218:2)\\n\\n\\u001b[0m \\u001b[90m 216 | \\u001b[39m  changePhotoURL\\u001b[33m,\\u001b[39m\\u001b[0m\\n\\u001b[0m \\u001b[90m 217 | \\u001b[39m  getUserToken\\u001b[33m,\\u001b[39m\\u001b[0m\\n\\u001b[0m\\u001b[31m\\u001b[1m>\\u001b[22m\\u001b[39m\\u001b[90m 218 | \\u001b[39m  signOut\\u001b[33m,\\u001b[39m\\u001b[0m\\n\\u001b[0m \\u001b[90m     | \\u001b[39m  \\u001b[31m\\u001b[1m^\\u001b[22m\\u001b[39m\\u001b[0m\\n\\u001b[0m \\u001b[90m 219 | \\u001b[39m  getDocument\\u001b[33m,\\u001b[39m\\u001b[0m\\n\\u001b[0m \\u001b[90m 220 | \\u001b[39m  updateDocument\\u001b[33m,\\u001b[39m\\u001b[0m\\n\\u001b[0m \\u001b[90m 221 | \\u001b[39m  getCollection\\u001b[33m,\\u001b[39m\\u001b[0m\\n    at Parser._raise (C:\\\\Users\\\\keega\\\\Documents\\\\cannlytics\\\\cannlytics\\\\node_modules\\\\@babel\\\\parser\\\\lib\\\\index.js:766:17)\\n    at Parser.raiseWithData (C:\\\\Users\\\\keega\\\\Documents\\\\cannlytics\\\\cannlytics\\\\node_modules\\\\@babel\\\\parser\\\\lib\\\\index.js:759:17)\\n    at Parser.raise (C:\\\\Users\\\\keega\\\\Documents\\\\cannlytics\\\\cannlytics\\\\node_modules\\\\@babel\\\\parser\\\\lib\\\\index.js:753:17)\\n    at Parser.parseTopLevel (C:\\\\Users\\\\keega\\\\Documents\\\\cannlytics\\\\cannlytics\\\\node_modules\\\\@babel\\\\parser\\\\lib\\\\index.js:11368:14)\\n    at Parser.parse (C:\\\\Users\\\\keega\\\\Documents\\\\cannlytics\\\\cannlytics\\\\node_modules\\\\@babel\\\\parser\\\\lib\\\\index.js:13045:10)\\n    at parse (C:\\\\Users\\\\keega\\\\Documents\\\\cannlytics\\\\cannlytics\\\\node_modules\\\\@babel\\\\parser\\\\lib\\\\index.js:13098:38)\\n    at parser (C:\\\\Users\\\\keega\\\\Documents\\\\cannlytics\\\\cannlytics\\\\node_modules\\\\@babel\\\\core\\\\lib\\\\parser\\\\index.js:54:34)\\n    at parser.next (<anonymous>)\\n    at normalizeFile (C:\\\\Users\\\\keega\\\\Documents\\\\cannlytics\\\\cannlytics\\\\node_modules\\\\@babel\\\\core\\\\lib\\\\transformation\\\\normalize-file.js:99:38)\\n    at normalizeFile.next (<anonymous>)\\n    at run (C:\\\\Users\\\\keega\\\\Documents\\\\cannlytics\\\\cannlytics\\\\node_modules\\\\@babel\\\\core\\\\lib\\\\transformation\\\\index.js:31:50)\\n    at run.next (<anonymous>)\\n    at Function.transform (C:\\\\Users\\\\keega\\\\Documents\\\\cannlytics\\\\cannlytics\\\\node_modules\\\\@babel\\\\core\\\\lib\\\\transform.js:27:41)\\n    at transform.next (<anonymous>)\\n    at step (C:\\\\Users\\\\keega\\\\Documents\\\\cannlytics\\\\cannlytics\\\\node_modules\\\\gensync\\\\index.js:254:32)\\n    at C:\\\\Users\\\\keega\\\\Documents\\\\cannlytics\\\\cannlytics\\\\node_modules\\\\gensync\\\\index.js:266:13\\n    at async.call.result.err.err (C:\\\\Users\\\\keega\\\\Documents\\\\cannlytics\\\\cannlytics\\\\node_modules\\\\gensync\\\\index.js:216:11)\");\n\n//# sourceURL=webpack://cannlytics/./console/assets/js/firebase.js?")},"./console/assets/js/index.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   "analyses": () => (/* reexport safe */ _analyses_analyses_js__WEBPACK_IMPORTED_MODULE_0__.analyses),\n/* harmony export */   "api": () => (/* reexport safe */ _api_api_js__WEBPACK_IMPORTED_MODULE_1__.api),\n/* harmony export */   "app": () => (/* reexport safe */ _app_app_js__WEBPACK_IMPORTED_MODULE_2__.app),\n/* harmony export */   "auth": () => (/* reexport safe */ _auth_auth_js__WEBPACK_IMPORTED_MODULE_3__.auth),\n/* harmony export */   "dashboard": () => (/* reexport safe */ _dashboard_dashboard_js__WEBPACK_IMPORTED_MODULE_4__.dashboard),\n/* harmony export */   "intake": () => (/* reexport safe */ _intake_intake_js__WEBPACK_IMPORTED_MODULE_5__.intake),\n/* harmony export */   "inventory": () => (/* reexport safe */ _inventory_inventory_js__WEBPACK_IMPORTED_MODULE_6__.inventory),\n/* harmony export */   "organizations": () => (/* reexport safe */ _organizations_organizations_js__WEBPACK_IMPORTED_MODULE_7__.organizations),\n/* harmony export */   "projects": () => (/* reexport safe */ _projects_projects_js__WEBPACK_IMPORTED_MODULE_8__.projects),\n/* harmony export */   "results": () => (/* reexport safe */ _results_results_js__WEBPACK_IMPORTED_MODULE_9__.results),\n/* harmony export */   "samples": () => (/* reexport safe */ _samples_samples_js__WEBPACK_IMPORTED_MODULE_10__.samples),\n/* harmony export */   "traceability": () => (/* reexport safe */ _traceability_traceability_js__WEBPACK_IMPORTED_MODULE_13__.traceability),\n/* harmony export */   "transfers": () => (/* reexport safe */ _transfers_transfers_js__WEBPACK_IMPORTED_MODULE_14__.transfers),\n/* harmony export */   "settings": () => (/* reexport safe */ _settings_settings_js__WEBPACK_IMPORTED_MODULE_11__.settings),\n/* harmony export */   "theme": () => (/* reexport safe */ _settings_theme_js__WEBPACK_IMPORTED_MODULE_12__.theme),\n/* harmony export */   "ui": () => (/* reexport safe */ _ui_ui_js__WEBPACK_IMPORTED_MODULE_15__.ui)\n/* harmony export */ });\n/* harmony import */ var _analyses_analyses_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./analyses/analyses.js */ "./console/assets/js/analyses/analyses.js");\n/* harmony import */ var _api_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./api/api.js */ "./console/assets/js/api/api.js");\n/* harmony import */ var _app_app_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./app/app.js */ "./console/assets/js/app/app.js");\n/* harmony import */ var _auth_auth_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./auth/auth.js */ "./console/assets/js/auth/auth.js");\n/* harmony import */ var _dashboard_dashboard_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./dashboard/dashboard.js */ "./console/assets/js/dashboard/dashboard.js");\n/* harmony import */ var _intake_intake_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./intake/intake.js */ "./console/assets/js/intake/intake.js");\n/* harmony import */ var _inventory_inventory_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./inventory/inventory.js */ "./console/assets/js/inventory/inventory.js");\n/* harmony import */ var _organizations_organizations_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./organizations/organizations.js */ "./console/assets/js/organizations/organizations.js");\n/* harmony import */ var _projects_projects_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./projects/projects.js */ "./console/assets/js/projects/projects.js");\n/* harmony import */ var _results_results_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./results/results.js */ "./console/assets/js/results/results.js");\n/* harmony import */ var _samples_samples_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./samples/samples.js */ "./console/assets/js/samples/samples.js");\n/* harmony import */ var _settings_settings_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./settings/settings.js */ "./console/assets/js/settings/settings.js");\n/* harmony import */ var _settings_theme_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./settings/theme.js */ "./console/assets/js/settings/theme.js");\n/* harmony import */ var _traceability_traceability_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./traceability/traceability.js */ "./console/assets/js/traceability/traceability.js");\n/* harmony import */ var _transfers_transfers_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./transfers/transfers.js */ "./console/assets/js/transfers/transfers.js");\n/* harmony import */ var _ui_ui_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./ui/ui.js */ "./console/assets/js/ui/ui.js");\n/**\r\n * Cannlytics Console JavaScript Module\r\n * Author: Keegan Skeate\r\n * Created: 12/3/2020\r\n * Updated: 6/18/2021\r\n */\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n//# sourceURL=webpack://cannlytics/./console/assets/js/index.js?')},"./console/assets/js/intake/intake.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"intake\": () => (/* binding */ intake)\n/* harmony export */ });\n/**\r\n * Intake JavaScript | Cannlytics Console\r\n * Author: Keegan Skeate\r\n * Created: 12/3/2020\r\n * Updated: 6/3/2021\r\n */\n// import Chart from 'chart.js';\n// TODO: Get transfers\n// TODO: search transfers\n// TODO: Create transfer\n// TODO: Edit transfer\n// TODO: Delete transfer\n// TODO: Get projects\n// TODO: Search projects\n// TODO: Create project\n// TODO: Edit project\n// TODO: Delete project\nvar intake = {\n  initialize() {\n    // console.log(this.getData())\n    console.log('Initializing intake..');\n    this.drawProgressGraph(); // var data = cannlyticsConsole.getData()\n    // cannlyticsConsole.renderGraph('myChart', data)\n  },\n\n  drawProgressGraph() {\n    var data = {\n      datasets: [{\n        data: [10, 20],\n        backgroundColor: ['rgba(255, 206, 86, 0.2)', 'rgba(54, 162, 235, 0.2)'],\n        borderColor: ['rgba(255, 206, 86, 1)', 'rgba(54, 162, 235, 1)'],\n        borderWidth: 1\n      }],\n      labels: ['In-Transit', 'Received']\n    }; // TODO: Get from Firestore\n\n    var ctx = document.getElementById('graph-progress');\n    var myPieChart = new Chart(ctx, {\n      type: 'pie',\n      data: data,\n      options: {\n        cutoutPercentage: 50\n      }\n    });\n  },\n\n  // TODO: Get data\n  getData() {\n    return [15339, 21345, 18483, 24003, 23489, 24092, 12034];\n  },\n\n  // TODO: Render graphs\n  renderGraph(id, data) {\n    var ctx = document.getElementById(id); // eslint-disable-next-line no-unused-vars\n\n    var myChart = new Chart(ctx, {\n      type: 'line',\n      data: {\n        labels: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],\n        datasets: [{\n          data: data,\n          lineTension: 0,\n          backgroundColor: 'transparent',\n          borderColor: '#007bff',\n          borderWidth: 4,\n          pointBackgroundColor: '#007bff'\n        }]\n      },\n      options: {\n        scales: {\n          yAxes: [{\n            ticks: {\n              beginAtZero: false\n            }\n          }]\n        },\n        legend: {\n          display: false\n        }\n      }\n    });\n  }\n\n};\n\n//# sourceURL=webpack://cannlytics/./console/assets/js/intake/intake.js?")},"./console/assets/js/inventory/areas.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   "areas": () => (/* binding */ areas)\n/* harmony export */ });\n/* harmony import */ var _api_api_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../api/api.js */ "./console/assets/js/api/api.js");\n/* harmony import */ var _firebase_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../firebase.js */ "./console/assets/js/firebase.js");\n/* harmony import */ var _firebase_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_firebase_js__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _settings_theme_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../settings/theme.js */ "./console/assets/js/settings/theme.js");\n/**\r\n * Areas | Cannlytics Console\r\n * Author: Keegan Skeate\r\n * Created: 12/3/2020\r\n */\n\n\n\nvar areas = {\n  initializeAreas() {\n    /*\r\n     * Initialize areas table.\r\n     */\n    _firebase_js__WEBPACK_IMPORTED_MODULE_1__.auth.onAuthStateChanged(user => {\n      this.getAreas();\n    });\n  },\n\n  getAreas() {\n    /*\r\n     * Get areas from Metrc through the API.\r\n     */\n    // TODO: Specify the columns.\n    var columnDefs = [{\n      field: "make",\n      sortable: true,\n      filter: true,\n      editable: true,\n      checkboxSelection: true\n    }, // , checkboxSelection: true\n    {\n      field: "model",\n      sortable: true,\n      filter: true,\n      editable: true\n    }, {\n      field: "price",\n      sortable: true,\n      filter: true,\n      editable: true\n    }]; // Specify the table options.\n\n    var gridOptions = {\n      columnDefs: columnDefs,\n      pagination: true,\n      rowSelection: \'multiple\',\n      suppressRowClickSelection: false,\n      // singleClickEdit: true,\n      // onRowClicked: event => console.log(\'A row was clicked\'),\n      onGridReady: event => _settings_theme_js__WEBPACK_IMPORTED_MODULE_2__.theme.toggleTheme(_settings_theme_js__WEBPACK_IMPORTED_MODULE_2__.theme.getTheme())\n    }; // Get the data and render the table.\n\n    _api_api_js__WEBPACK_IMPORTED_MODULE_0__.api.getAreas().then(data => {\n      console.log(\'Areas:\', data);\n      var eGridDiv = document.querySelector(\'#areas-table\');\n      new agGrid.Grid(eGridDiv, gridOptions);\n      gridOptions.api.setRowData(data);\n    }).catch(error => {\n      console.log(\'Error:\', error);\n    }); // TODO: Attach export functionality\n    //function exportTableData() {\n    //  gridOptions.api.exportDataAsCsv();\n    //}\n  }\n\n};\n\n//# sourceURL=webpack://cannlytics/./console/assets/js/inventory/areas.js?')},"./console/assets/js/inventory/inventory.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   "inventory": () => (/* binding */ inventory)\n/* harmony export */ });\n/* harmony import */ var _areas_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./areas.js */ "./console/assets/js/inventory/areas.js");\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n/**\r\n * Inventory | Cannlytics Console\r\n * Author: Keegan Skeate\r\n * Created: 4/24/2021\r\n */\n\nvar inventory = _objectSpread({}, _areas_js__WEBPACK_IMPORTED_MODULE_0__.areas);\n\n//# sourceURL=webpack://cannlytics/./console/assets/js/inventory/inventory.js?')},"./console/assets/js/organizations/organizations.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"organizations\": () => (/* binding */ organizations)\n/* harmony export */ });\n/* harmony import */ var _api_api_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../api/api.js */ \"./console/assets/js/api/api.js\");\n/* harmony import */ var _settings_theme_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../settings/theme.js */ \"./console/assets/js/settings/theme.js\");\n/* harmony import */ var _firebase_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../firebase.js */ \"./console/assets/js/firebase.js\");\n/* harmony import */ var _firebase_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_firebase_js__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../utils.js */ \"./console/assets/js/utils.js\");\n/**\r\n * Organizations JavaScript | Cannlytics Console\r\n * Author: Keegan Skeate\r\n * Created: 6/9/2021\r\n * Updated: 6/11/2021\r\n */\n\n\n\n\nvar organizations = {\n  initialize() {\n    /*\r\n     * Initialize the organizations user interface.\r\n     */\n    console.log('Initializing organizations!');\n    this.getOrganizations('organizations-table');\n  },\n\n  changeActiveOrganization(orgId) {\n    /*\r\n     * Change the active organization for the user.\r\n     */\n    // TODO: Move orgId to beginning of user's list and refresh.\n    console.log('Change organizations:', orgId);\n  },\n\n  getOrganizations(tableId) {\n    /*\r\n     * Get and display a user's organizations.\r\n     */\n    // TODO: Specify the columns.\n    // address: \"\"\n    // city: \"\"\n    // country: \"\"\n    // email: \"\"\n    // external_id: \"\"\n    // linkedin: \"\"\n    // name: \"Cannlytics\"\n    // owner: \"v86tNoemQzgrnMvlWq6mxCASg523\"\n    // phone: \"\"\n    // public: \"false\"\n    // state: \"\"\n    // team: [\"v86tNoemQzgrnMvlWq6mxCASg523\"]\n    // trade_name: \"\"\n    // uid: \"cannlytics\"\n    // website: \"\"\n    // zip_code: \"\"\n    var columnDefs = [{\n      field: 'name',\n      sortable: true,\n      filter: true\n    }, {\n      field: 'email',\n      sortable: true,\n      filter: true\n    }, {\n      field: 'phone',\n      sortable: true,\n      filter: true\n    }]; // Specify the table options.\n\n    var gridOptions = {\n      columnDefs: columnDefs,\n      pagination: true,\n      rowSelection: 'multiple',\n      suppressRowClickSelection: false,\n      // singleClickEdit: true,\n      // onRowClicked: event => console.log('A row was clicked'),\n      onGridReady: event => _settings_theme_js__WEBPACK_IMPORTED_MODULE_1__.theme.toggleTheme(_settings_theme_js__WEBPACK_IMPORTED_MODULE_1__.theme.getTheme())\n    }; // Get the data and render the table.\n\n    _api_api_js__WEBPACK_IMPORTED_MODULE_0__.api.get('organizations').then(data => {\n      console.log('Table data:', data); // DEV:\n\n      var eGridDiv = document.querySelector(\"#\".concat(tableId));\n      new agGrid.Grid(eGridDiv, gridOptions);\n      gridOptions.api.setRowData(data);\n    }).catch(error => {\n      console.log('Error:', error);\n    }); // TODO: Attach export functionality\n    //function exportTableData() {\n    //  gridOptions.api.exportDataAsCsv();\n    //}\n  },\n\n  updateOrganization() {\n    /*\r\n     * \r\n     */\n  },\n\n  createOrganization() {\n    /*\r\n     * \r\n     */\n  },\n\n  deleteOrganization() {\n    /*\r\n     * \r\n     */\n  },\n\n  joinOrganizationRequest() {\n    /*\r\n     * Send the owner of an organization a request for a user to join.\r\n     */\n    var organization = document.getElementById('join-organization-input').value;\n\n    if (!organization) {\n      (0,_utils_js__WEBPACK_IMPORTED_MODULE_3__.showNotification)('Organization required', 'Enter an organization name.', {\n        type: 'error'\n      });\n      return;\n    }\n\n    (0,_utils_js__WEBPACK_IMPORTED_MODULE_3__.authRequest)('/api/organizations/join', {\n      organization,\n      join: true\n    }).then(response => {\n      if (response.success) {\n        (0,_utils_js__WEBPACK_IMPORTED_MODULE_3__.showNotification)('Organization request sent', response.message, {\n          type: 'success'\n        });\n      } else {\n        (0,_utils_js__WEBPACK_IMPORTED_MODULE_3__.showNotification)('Organization request failed', response.message, {\n          type: 'error'\n        });\n      }\n    });\n  },\n\n  saveOrganization(orgType) {\n    /*\r\n     * Save's a user's organization choice.\r\n     */\n    // FIXME:\n    var elements = document.getElementById('create-organization-form').elements;\n    var data = {};\n\n    for (var i = 0; i < elements.length; i++) {\n      var item = elements.item(i);\n      if (item.name) data[item.name] = item.value;\n    }\n\n    var orgId = (0,_utils_js__WEBPACK_IMPORTED_MODULE_3__.slugify)(data['name']);\n    console.log('Org ID:', orgId);\n    console.log('Data to upload:', data);\n    (0,_utils_js__WEBPACK_IMPORTED_MODULE_3__.authRequest)(\"/api/organizations\", data).then(response => {\n      console.log('Saved org:', response); // TODO: Show better error messages.\n      // TODO: Tell user if organization name is already taken\n\n      if (response.error) {\n        (0,_utils_js__WEBPACK_IMPORTED_MODULE_3__.showNotification)('Organization request failed', response.message, {\n          type: 'error'\n        });\n      } else {\n        // showNotification('Organization request sent', response.message, { type: 'success' });\n        var baseURL = window.location.origin;\n        document.location.href = \"\".concat(baseURL, \"/get-started/support/?from=\").concat(orgType);\n      }\n    });\n  },\n\n  uploadOrgPhoto(orgId) {\n    /*\r\n     * Upload a photo for an organization through the API.\r\n     */\n    if (this.files.length) {\n      // Show a notification.\n      (0,_utils_js__WEBPACK_IMPORTED_MODULE_3__.showNotification)('Uploading photo', 'Uploading your organization picture...', {\n        type: 'wait'\n      }); // Fill the photo into the UI.\n\n      (0,_firebase_js__WEBPACK_IMPORTED_MODULE_2__.changePhotoURL)(this.files[0]).then(downloadURL => {\n        (0,_utils_js__WEBPACK_IMPORTED_MODULE_3__.authRequest)('/api/organizations', {\n          photo_url: downloadURL,\n          uid: orgId\n        });\n        document.getElementById('org-photo-url').src = downloadURL;\n        (0,_utils_js__WEBPACK_IMPORTED_MODULE_3__.showNotification)('Uploading photo complete', 'Successfully uploaded organization picture.', {\n          type: 'success'\n        });\n      }).catch(error => {\n        (0,_utils_js__WEBPACK_IMPORTED_MODULE_3__.showNotification)('Photo Change Error', _firebase_js__WEBPACK_IMPORTED_MODULE_2__.storageErrors[error.code], {\n          type: 'error'\n        });\n      });\n    }\n  },\n\n  viewOrganization(orgId) {\n    /*\r\n     * View an organization on navigation.\r\n     */\n    (0,_utils_js__WEBPACK_IMPORTED_MODULE_3__.authRequest)(\"/api/organizations/\".concat(orgId)).then(response => {\n      if (response.data) {\n        console.log('Retrieved data:', response.data);\n        (0,_utils_js__WEBPACK_IMPORTED_MODULE_3__.formDeserialize)(document.forms['organization-form'], response.data);\n      } else {\n        console.log(response);\n      }\n    });\n  }\n\n};\n/*\r\n * UI Management\r\n */\n\nfunction initializeGetStartedOrganizationUI(data) {\n  /*\r\n   * Initialize the get-started organization section.\r\n   */\n  // Populate form.\n  // const { elements } = document.querySelector('form')\n  // for (const [ key, value ] of Object.entries(data)) {\n  //   const field = elements.namedItem(key)\n  //   try {\n  //     field && (field.value = value);\n  //   } catch(error) {}\n  // }\n  // Attach functionality.\n  var fileElem = document.getElementById('selectPhotoUrl');\n  fileElem.addEventListener('change', uploadOrgPhoto, false);\n}\n\n//# sourceURL=webpack://cannlytics/./console/assets/js/organizations/organizations.js?")},"./console/assets/js/projects/projects.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"projects\": () => (/* binding */ projects)\n/* harmony export */ });\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils.js */ \"./console/assets/js/utils.js\");\n/* harmony import */ var _settings_theme_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../settings/theme.js */ \"./console/assets/js/settings/theme.js\");\n/**\r\n * Projects JavaScript | Cannlytics Console\r\n * Author: Keegan Skeate\r\n * Created: 6/18/2021\r\n * Updated: 6/18/2021\r\n */\n\n\nvar projects = {\n  initialize() {\n    console.log('Initializing projects!');\n  },\n\n  getProjects(orgId, licenseNumber) {\n    var versionId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'latest';\n\n    /*\r\n     * Get projects.\r\n     */\n    // Get the data.\n    // TODO: Add parameters\n    var query = \"license=\".concat(licenseNumber, \"&org_id=\").concat(orgId, \"&version_id=\").concat(versionId);\n    var url = \"/api/projects?\".concat(query);\n    (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)(url).then(response => {\n      var {\n        data\n      } = response;\n\n      if (data) {\n        document.getElementById('data-placeholder').classList.add('d-none');\n        document.getElementById('data-table').classList.remove('d-none');\n      }\n\n      console.log('Table data:', data); // TODO: Define the columns for the table.\n\n      var columnDefs = [{\n        field: 'project_id',\n        headerName: 'Project ID',\n        sortable: true,\n        filter: true\n      }]; // Specify the table options.\n\n      var gridOptions = {\n        columnDefs: columnDefs,\n        pagination: true,\n        paginationAutoPageSize: true,\n        suppressRowClickSelection: false,\n        onRowClicked: event => this.openProject(event),\n        onGridReady: event => _settings_theme_js__WEBPACK_IMPORTED_MODULE_1__.theme.toggleTheme(_settings_theme_js__WEBPACK_IMPORTED_MODULE_1__.theme.getTheme())\n      }; // Render the table\n\n      var eGridDiv = document.querySelector(\"#\".concat(tableId));\n      new agGrid.Grid(eGridDiv, gridOptions);\n      gridOptions.api.setRowData(data);\n    });\n  },\n\n  deleteProject(projectId, orgId, licenseNumber) {\n    var versionId = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'latest';\n\n    /*\r\n     * Delete a project.\r\n     */\n    var url = \"/api/projects/\".concat(projectId);\n    var filters = \"?license=\".concat(licenseNumber, \"&org_id=\").concat(orgId, \"&version_id=\").concat(versionId);\n    (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)(url + filters, null, {\n      delete: true\n    }).then(response => {\n      if (response.error) {\n        (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.showNotification)('Deleting project failed', response.message, {\n          type: 'error'\n        });\n      } else {\n        var message = \"Project deleted from your database, hopefully you know what you're doing!\";\n        (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.showNotification)('Project deleted', message, {\n          type: 'success'\n        });\n      }\n    });\n  },\n\n  saveProject() {\n    /*\r\n     * Create or update a project.\r\n     */\n    var form = document.getElementById('project-form');\n    var data = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.formSerialize)(form);\n    (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)(\"/api/projects/\".concat(data.project_id), data).then(response => {\n      if (response.error) {\n        (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.showNotification)('Error saving project', response.message, {\n          type: 'error'\n        });\n      } else {\n        (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.showNotification)('Project saved', 'Project data saved.', {\n          type: 'success'\n        });\n      }\n    });\n  },\n\n  openProject(row) {\n    /*\r\n     * Navigate to a selected project.\r\n     */\n    localStorage.setItem('project', JSON.stringify(row.data));\n    window.location.href = \"/projects/project?id=\".concat(row.data.id);\n  },\n\n  viewProject() {\n    /*\r\n     * Render a project's data when navigating to a project page.\r\n     */\n    var data = JSON.parse(localStorage.getItem('project'));\n    (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.formDeserialize)(document.forms['project-form'], data);\n  },\n\n  importProjects() {\n    /*\r\n     * Import a data file (.csv or .xlsx) of project data.\r\n     */\n    // TODO:\n  },\n\n  exportProjects() {\n    /*\r\n     * Import a data file (.csv or .xlsx) of project data.\r\n     */\n    // TODO:\n  }\n\n};\n\n//# sourceURL=webpack://cannlytics/./console/assets/js/projects/projects.js?")},"./console/assets/js/results/results.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"results\": () => (/* binding */ results)\n/* harmony export */ });\n/**\r\n * Results JavaScript | Cannlytics Console\r\n * Author: Keegan Skeate\r\n * Created: 6/18/2020\r\n * Updated: 6/18/2021\r\n */\nvar results = {\n  initialize() {\n    console.log('Initializing results!');\n  }\n\n};\n\n//# sourceURL=webpack://cannlytics/./console/assets/js/results/results.js?")},"./console/assets/js/samples/samples.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"samples\": () => (/* binding */ samples)\n/* harmony export */ });\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils.js */ \"./console/assets/js/utils.js\");\n/* harmony import */ var _settings_theme_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../settings/theme.js */ \"./console/assets/js/settings/theme.js\");\n/**\r\n * Samples JavaScript | Cannlytics Console\r\n * Author: Keegan Skeate\r\n * Created: 6/9/2021\r\n * Updated: 6/18/2021\r\n */\n\n\nvar samples = {\n  initialize() {\n    console.log('Initializing samples!');\n  },\n\n  getSamples(orgId, licenseNumber) {\n    var versionId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'latest';\n\n    /*\r\n    * Get samples.\r\n    */\n    // Get the data.\n    // TODO: Add parameters\n    var query = \"license=\".concat(licenseNumber, \"&org_id=\").concat(orgId, \"&version_id=\").concat(versionId);\n    var url = \"/api/samples?\".concat(query);\n    (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)(url).then(response => {\n      var {\n        data\n      } = response;\n\n      if (data) {\n        document.getElementById('data-placeholder').classList.add('d-none');\n        document.getElementById('data-table').classList.remove('d-none');\n      }\n\n      console.log('Table data:', data); // TODO: Define the columns for the table.\n\n      var columnDefs = [{\n        field: 'sample_id',\n        headerName: 'Sample ID',\n        sortable: true,\n        filter: true\n      }]; // Specify the table options.\n\n      var gridOptions = {\n        columnDefs: columnDefs,\n        pagination: true,\n        paginationAutoPageSize: true,\n        suppressRowClickSelection: false,\n        onRowClicked: event => this.openProject(event),\n        onGridReady: event => _settings_theme_js__WEBPACK_IMPORTED_MODULE_1__.theme.toggleTheme(_settings_theme_js__WEBPACK_IMPORTED_MODULE_1__.theme.getTheme())\n      }; // Render the table\n\n      var eGridDiv = document.querySelector(\"#\".concat(tableId));\n      new agGrid.Grid(eGridDiv, gridOptions);\n      gridOptions.api.setRowData(data);\n    });\n  },\n\n  deleteSample(sampleId, orgId, licenseNumber) {\n    var versionId = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'latest';\n\n    /*\r\n    * Delete a sample.\r\n    */\n    var url = \"/api/samples/\".concat(sampleId);\n    var filters = \"?license=\".concat(licenseNumber, \"&org_id=\").concat(orgId, \"&version_id=\").concat(versionId);\n    (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)(url + filters, null, {\n      delete: true\n    }).then(response => {\n      if (response.error) {\n        (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.showNotification)('Deleting sample failed', response.message, {\n          type: 'error'\n        });\n      } else {\n        var message = \"Sample deleted and removed from its project.\";\n        (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.showNotification)('Sample deleted', message, {\n          type: 'success'\n        });\n      }\n    });\n  },\n\n  saveSample() {\n    /*\r\n    * Create or update a sample.\r\n    */\n    var form = document.getElementById('sample-form');\n    var data = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.formSerialize)(form);\n    (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)(\"/api/samples/\".concat(data.sample_id), data).then(response => {\n      if (response.error) {\n        (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.showNotification)('Error saving sample', response.message, {\n          type: 'error'\n        });\n      } else {\n        (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.showNotification)('Sample saved', 'Sample data saved.', {\n          type: 'success'\n        });\n      }\n    });\n  },\n\n  openSample(row) {\n    /*\r\n    * Navigate to a selected sample.\r\n    */\n    localStorage.setItem('sample', JSON.stringify(row.data));\n    window.location.href = \"/samples/sample?id=\".concat(row.data.id);\n  },\n\n  viewSample() {\n    /*\r\n    * Render a sample's data when navigating to a sample page.\r\n    */\n    var data = JSON.parse(localStorage.getItem('sample'));\n    (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.formDeserialize)(document.forms['sample-form'], data);\n  }\n\n};\n\n//# sourceURL=webpack://cannlytics/./console/assets/js/samples/samples.js?")},"./console/assets/js/settings/errors.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"errorSettings\": () => (/* binding */ errorSettings)\n/* harmony export */ });\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils.js */ \"./console/assets/js/utils.js\");\n/**\r\n * Errors JavaScript | Cannlytics Console\r\n * Author: Keegan Skeate\r\n * Created: 4/28/2021\r\n * Updated: 6/3/2021\r\n */\n\nvar errorSettings = {\n  reportError(data) {\n    /*\r\n     * Reports an error to the back-end.\r\n     */\n    (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)('/api/errors', data).then(() => {\n      var message = 'Thank you for reporting this error. We will try to address it as soon as possible.';\n      showNotification('Error report sent', message, {\n        type: 'success'\n      });\n    }).catch(error => {\n      var message = \"We're sorry, your error report failed to send. We will still try to find the root cause if possible.\";\n      showNotification('Failed to send error report', message, {\n        type: 'error'\n      });\n    });\n  }\n\n};\n\n//# sourceURL=webpack://cannlytics/./console/assets/js/settings/errors.js?")},"./console/assets/js/settings/settings.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"settings\": () => (/* binding */ settings)\n/* harmony export */ });\n/* harmony import */ var _firebase_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../firebase.js */ \"./console/assets/js/firebase.js\");\n/* harmony import */ var _firebase_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_firebase_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _user_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./user.js */ \"./console/assets/js/settings/user.js\");\n/* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./errors.js */ \"./console/assets/js/settings/errors.js\");\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../utils.js */ \"./console/assets/js/utils.js\");\n/* harmony import */ var _ui_ui_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../ui/ui.js */ \"./console/assets/js/ui/ui.js\");\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n/**\r\n * Settings JavaScript | Cannlytics Console\r\n * Author: Keegan Skeate\r\n * Created: 12/3/2020\r\n * Updated: 6/17/2021\r\n */\n\n\n\n\n\nvar apiSettings = {\n  createAPIKey() {\n    /* \r\n    * Create an API key.\r\n    */\n    var data = (0,_utils_js__WEBPACK_IMPORTED_MODULE_3__.serializeForm)('new-api-key-form');\n    _ui_ui_js__WEBPACK_IMPORTED_MODULE_4__.ui.showLoadingButton('create-api-key-button');\n    (0,_utils_js__WEBPACK_IMPORTED_MODULE_3__.apiRequest)('/api/create-key', data).then(response => {\n      // Optional: Add new key to the table and show the table without reloading!\n      window.location.reload();\n    }).finally(() => {\n      _ui_ui_js__WEBPACK_IMPORTED_MODULE_4__.ui.hideLoadingButton('create-api-key-button');\n    });\n  },\n\n  deleteAPIKey() {\n    /* \r\n    * Delete an API key.\r\n    */\n    // FIXME:\n    var data = (0,_utils_js__WEBPACK_IMPORTED_MODULE_3__.serializeForm)('api-key-form'); // ui.showLoadingButton('create-api-key-button');\n\n    (0,_utils_js__WEBPACK_IMPORTED_MODULE_3__.apiRequest)('/api/delete-key', data).then(response => {\n      if (response.error) {\n        (0,_utils_js__WEBPACK_IMPORTED_MODULE_3__.showNotification)('Error deleting API key', response.message, {\n          type: 'error'\n        });\n        return;\n      } // Optional: Add new key to the table and show the table without reloading!\n\n\n      window.location.reload();\n    }); // .finally(() => {\n    //   ui.hideLoadingButton('create-api-key-button');\n    // });\n  },\n\n  getAPIKeys(uid) {\n    /* \r\n    * Get all of a user's API key information.\r\n    */\n    console.log('Getting all API keys...', uid); // FIXME: Get from /api/get_api_key_hmacs instead\n\n    return new Promise((resolve, reject) => {\n      (0,_utils_js__WEBPACK_IMPORTED_MODULE_3__.apiRequest)('/api/get-keys').then(response => {\n        resolve(response['data']);\n      }); // db.collection('admin').doc('api').collection('api_key_hmacs')\n      // .get()\n      // .then((querySnapshot) => {\n      //   const data = [];\n      //   querySnapshot.forEach((doc) => {\n      //     data.push(doc.data());\n      //   });\n      //   resolve(data);\n      // })\n      // .catch((error) => {\n      //   reject(error);\n      // });\n      // .onSnapshot((querySnapshot) => {\n      //   var data = [];\n      //   querySnapshot.forEach((doc) => {\n      //     data.push(doc.data().name);\n      //   });\n      //   resolve(data);\n      // });\n    }); // const ref = db.collection('admin').document('api').collection('api_key_hmacs')\n    //   .where('uid', '==', uid);\n    // ref.onSnapshot(snapshot => {\n    //   snapshot.docChanges.forEach(change => {\n    //     this.renderAPIKey(change);\n    //   });\n    // });\n  },\n\n  renderAPIKey(change) {\n    /* \r\n    * Get all of a user's API key information.\r\n    */\n    if (change.type === 'added') {\n      console.log('Add data to table:', change.doc);\n    } else if (change.type === 'removed') {\n      console.log('Remove row from table:', change.doc.id);\n    }\n  },\n\n  selectAPIKey(data) {\n    /*\r\n     * Select an API key from the table.\r\n     */\n  },\n\n  viewAPIKey() {\n    /*\r\n     * Render a project's data when navigating to a project page.\r\n     */\n    var data = JSON.parse(localStorage.getItem('api-key'));\n    (0,_utils_js__WEBPACK_IMPORTED_MODULE_3__.formDeserialize)(document.forms['api-key-form'], data);\n    console.log(data);\n  }\n\n}; // const organizationSettings = {\n//   newOrganization() {\n//     // const id = uuidv4();\n//     // TODO:\n//     console.log('Create new org');\n//   },\n//   addOrganization(data) {\n//     /* \n//     * Add an organizations.\n//     */\n//     const collection = db.collection('organizations');\n//     return collection.add(data);\n//   },\n//   getOrganizations() {\n//     /* \n//     * Get all of a user's organizations.\n//     */\n//     auth.onAuthStateChanged((user) => {\n//       if (user) {\n//         // console.log(user.uid);\n//         // TODO: Get all of a users/{id} org_id's.\n//         // TODO: Get all organizations/{id} documents for org_id's.\n//         console.log('Get all organizations for user id:', user.uid);\n//         // const query = db.collection('organizations').limit(50);\n//         // query.onSnapshot(snapshot => {\n//         //   if (!snapshot.size) return render();\n//         //   snapshot.docChanges.forEach(change => {\n//         //     if (change.type === 'added') {\n//         //       render(change.doc);\n//         //     }\n//         //     else if (change.type === 'removed') {\n//         //       document.getElementById(change.doc.id).remove();\n//         //     }\n//         //   });\n//         // });\n//       }\n//     });\n//   //  idbStore.get('user').then((data) => {\n//   //   console.log('IDB User:', data);\n//   //   console.log('Getting organizations!');\n//   //  });\n//   },\n//   archiveOrganizations() {\n//     /* \n//     * Archive one of a user's organizations.\n//     */\n//    // TODO: Add to archived organizations.\n//     const collection = firebase.firestore().collection('ships');\n//     return collection.doc(id).delete()\n//       .catch(function(error) {\n//         console.error('Error removing document: ', error);\n//       });\n//   },\n//   updateOrganization() {\n//     /* \n//     * Update a user's organizations.\n//     */\n//     // TODO:\n//   },\n// }\n\nvar coreSettings = {\n  exportData(model) {\n    var id = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n\n    /*\r\n     * Export given collection data to Excel.\r\n     */\n    // TODO: Serialize the analysis data!\n    console.log('TODO: export data for', model, id);\n    var data = {}; // api.createAnalyses(data);\n  },\n\n  importData(model) {\n    /*\r\n     * Import a data file (.csv or .xlsx) to Firestore for a given model type.\r\n     */\n    // TODO:\n    console.log('TODO: import data:', model);\n  },\n\n  getOrganizationLogs(orgId) {\n    /* \r\n    * Record time and user of any activity.\r\n    */\n  },\n\n  getUserLogs(orgId) {\n    /* \r\n    * Record time and user of any activity.\r\n    */\n  },\n\n  logAction() {\n    /* \r\n    * Record time and user of any activity.\r\n    */\n    // TODO:\n  },\n\n  sendFeedback() {\n    /*\r\n     * Send feedback through Firestore-triggered Google Cloud Function.\r\n     */\n    var user = _firebase_js__WEBPACK_IMPORTED_MODULE_0__.auth.currentUser || {};\n    var message = document.getElementById('feedback-message').value;\n    var timestamp = Date.now().toString(); // Optional: Specify time zone.\n\n    var code = Math.random().toString(36).slice(-3);\n    var data = {\n      name: user.displayName || 'Anonymous user',\n      email: user.email || 'No user',\n      organization: user.organization || 'No organization',\n      body: message,\n      from: 'contact@cannlytics.com',\n      reply: 'contact@cannlytics.com',\n      recipients: ['contact@cannlytics.com'],\n      subject: 'New Cannlytics Console feedback!',\n      promo: code\n    };\n    _firebase_js__WEBPACK_IMPORTED_MODULE_0__.db.collection('users').doc(user.uid).collection('feedback').doc(timestamp).set(data).then(() => {\n      (0,_utils_js__WEBPACK_IMPORTED_MODULE_3__.showNotification)('Feedback sent', 'Thank you for your feedback', {\n        type: 'success'\n      });\n    }).catch(error => {\n      (0,_utils_js__WEBPACK_IMPORTED_MODULE_3__.showNotification)('Error sending feedback', error.message, {\n        type: 'error'\n      });\n    });\n  }\n\n};\n/*------------------------------------------------------------------------------\r\n * Module export\r\n *----------------------------------------------------------------------------*/\n\nvar settings = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, apiSettings), coreSettings), _errors_js__WEBPACK_IMPORTED_MODULE_2__.errorSettings), _user_js__WEBPACK_IMPORTED_MODULE_1__.userSettings);\n\n//# sourceURL=webpack://cannlytics/./console/assets/js/settings/settings.js?")},"./console/assets/js/settings/theme.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"theme\": () => (/* binding */ theme)\n/* harmony export */ });\n/**\r\n * Theme JavaScript | Cannlytics Console\r\n * Author: Keegan Skeate\r\n * Created: 12/6/2020\r\n * Updated: 4/24/2021\r\n */\nvar theme = {\n  changeTheme() {\n    /*\r\n     * Change the UI theme.\r\n     */\n    var theme = localStorage.getItem('theme');\n\n    if (!theme) {\n      var hours = new Date().getHours();\n      var dayTime = hours > 6 && hours < 20;\n      theme = dayTime ? 'light' : 'dark';\n    }\n\n    var newTheme = theme === 'light' ? 'dark' : 'light';\n    this.toggleTheme(newTheme);\n    localStorage.setItem('theme', newTheme);\n  },\n\n  getTheme() {\n    /*\r\n     * Get the current theme.\r\n     */\n    return document.body.classList.contains('dark') ? 'dark' : 'light';\n  },\n\n  setInitialTheme() {\n    /*\r\n     * Set th initial UI theme.\r\n     */\n    if (typeof Storage !== 'undefined') {\n      var theme = localStorage.getItem('theme');\n\n      if (!theme) {\n        var hours = new Date().getHours();\n        var dayTime = hours > 6 && hours < 20;\n        if (!dayTime) this.toggleTheme('dark');\n        return;\n      }\n\n      this.toggleTheme(theme);\n      localStorage.setItem('theme', theme);\n    }\n  },\n\n  setTableTheme() {\n    /*\r\n     * Set the appropriate theme for tables based on the current theme.\r\n     */\n    console.log('Setting theme on tables...');\n    var nuisanceTableClass = 'ag-theme-alpine-dark';\n    var finalTableClass = 'ag-theme-alpine';\n\n    if (hasClass(document.body, 'dark')) {\n      nuisanceTableClass = 'ag-theme-alpine';\n      finalTableClass = 'ag-theme-alpine-dark';\n    } // Toggle Ag-Grid theme.\n\n\n    var tables = document.getElementsByClassName(nuisanceTableClass);\n    [...tables].forEach(x => x.classList.add(finalTableClass));\n    [...tables].forEach(x => x.classList.remove(nuisanceTableClass));\n  },\n\n  toggleTheme(theme) {\n    /*\r\n     * Toggle the UI theme, toggling AG-Grid table class.\r\n     */\n    var currentTableClass = 'ag-theme-alpine';\n    var newTableClass = 'ag-theme-alpine-dark';\n\n    if (theme === 'light') {\n      document.body.className = 'base';\n      currentTableClass = 'ag-theme-alpine-dark';\n      newTableClass = 'ag-theme-alpine';\n    } else {\n      document.body.classList.add('dark');\n    } // Toggle Ag-Grid theme.\n\n\n    var tables = document.getElementsByClassName(currentTableClass);\n    [...tables].forEach(x => x.classList.add(newTableClass));\n    [...tables].forEach(x => x.classList.remove(currentTableClass));\n  }\n\n};\n\nfunction hasClass(element, className) {\n  return (' ' + element.className + ' ').indexOf(' ' + className + ' ') > -1;\n}\n\n//# sourceURL=webpack://cannlytics/./console/assets/js/settings/theme.js?")},"./console/assets/js/settings/user.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"userSettings\": () => (/* binding */ userSettings)\n/* harmony export */ });\n/* harmony import */ var _firebase_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../firebase.js */ \"./console/assets/js/firebase.js\");\n/* harmony import */ var _firebase_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_firebase_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils.js */ \"./console/assets/js/utils.js\");\n/**\r\n * User Settings JavaScript | Cannlytics Console\r\n * Author: Keegan Skeate <keegan@cannlytics.com>\r\n * Created: 1/2/2021\r\n * Updated: 6/17/2021\r\n */\n\n\nvar userSettings = {\n  chooseUserPhoto() {\n    /*\r\n     * Choose a file to upload.\r\n     */\n    var fileSelect = document.getElementById('userPhotoUrl');\n    fileSelect.click();\n  },\n\n  exportAccount(data) {\n    /* \r\n    * TODO: Exports a user's data.\r\n    */\n    console.log('Export all of a users data to Excel.');\n  },\n\n  initializeAccountForm() {\n    /*\r\n     * Initialize the user account form.\r\n     */\n    var fileElem = document.getElementById('userPhotoUrl');\n    fileElem.addEventListener('change', this.uploadUserPhoto, false);\n    this.resetAccountForm();\n  },\n\n  resetAccountForm() {\n    /*\r\n     * Reset a form with currently saved data, replacing any changes.\r\n     */\n    (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.authRequest)('/api/users').then(data => {\n      console.log('User data:', data);\n      var userForm = document.forms['user-form'];\n      userForm.reset();\n      (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.formDeserialize)(userForm, data);\n    });\n  },\n\n  saveAccount() {\n    /* \r\n    * Saves a user's account fields.\r\n    */\n    var user = _firebase_js__WEBPACK_IMPORTED_MODULE_0__.auth.currentUser;\n    var data = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.serializeForm)('user-form');\n\n    if (data.email !== user.email) {\n      user.updateEmail(data.email);\n    }\n\n    if (data.name !== user.displayName) {\n      user.updateProfile({\n        displayName: data.name\n      });\n    }\n\n    (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.authRequest)('/api/users', data).then(() => {\n      var message = 'Your account data has been successfully saved.';\n      (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.showNotification)('Account saved', message, {\n        type: 'success'\n      });\n    });\n  },\n\n  uploadUserPhoto() {\n    /*\r\n     * Upload a user's photo through the API.\r\n     */\n    if (this.files.length) {\n      (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.showNotification)('Uploading photo', 'Uploading your profile picture...', {\n        type: 'wait'\n      });\n      (0,_firebase_js__WEBPACK_IMPORTED_MODULE_0__.changePhotoURL)(this.files[0]).then(downloadURL => {\n        (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.authRequest)('/api/users', {\n          photo_url: downloadURL\n        });\n        document.getElementById('user-photo-url').src = downloadURL;\n        document.getElementById('userPhotoNav').src = downloadURL;\n        document.getElementById('userPhotoMenu').src = downloadURL;\n        var message = 'Successfully uploaded your profile picture.';\n        (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.showNotification)('Uploading photo complete', message, {\n          type: 'success'\n        });\n      }).catch(error => {\n        (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.showNotification)('Photo Change Error', _firebase_js__WEBPACK_IMPORTED_MODULE_0__.storageErrors[error.code], {\n          type: 'error'\n        });\n      });\n    }\n  },\n\n  createPin(data) {\n    /* \r\n    * Create a pin for a user.\r\n    */\n    // TODO:\n    console.log('Todo: Create a pin!');\n  },\n\n  uploadSignature(data) {\n    /* \r\n    * Upload a signature for a user.\r\n    */\n    // TODO:\n    var collection = db.collection('organizations');\n    return collection.add(data);\n  },\n\n  deleteSignature(data) {\n    /* \r\n    * Remove a signature from a user.\r\n    */\n    // TODO:\n    var collection = db.collection('organizations');\n    return collection.add(data);\n  }\n\n};\n\n//# sourceURL=webpack://cannlytics/./console/assets/js/settings/user.js?")},"./console/assets/js/traceability/traceability.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"traceability\": () => (/* binding */ traceability)\n/* harmony export */ });\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils.js */ \"./console/assets/js/utils.js\");\n/* harmony import */ var _settings_theme_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../settings/theme.js */ \"./console/assets/js/settings/theme.js\");\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n/**\r\n * Traceability JavaScript | Cannlytics Console\r\n * Author: Keegan Skeate\r\n * Created: 6/12/2021\r\n * Updated: 6/14/2021\r\n */\n\n // Optional: Setup Index DB for client-side storage.\n// import { idbStore } from '../store.js';\n// https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Client-side_web_APIs/Client-side_storage#storing_complex_data_%E2%80%94_indexeddb\n\n/*---------------------------------------------------------------------\r\n Employees\r\n --------------------------------------------------------------------*/\n\nvar employees = {\n  getEmployees(tableId, orgId, licenseNumber, versionId) {\n    /* Get data from the API and in a table. */\n    // Get the data.\n    var query = \"license=\".concat(licenseNumber, \"&org_id=\").concat(orgId, \"&version_id=\").concat(versionId);\n    var url = \"/api/traceability/employees?\".concat(query);\n    (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)(url).then(response => {\n      var {\n        data\n      } = response;\n\n      if (data) {\n        document.getElementById('data-placeholder').classList.add('d-none');\n        document.getElementById('data-table').classList.remove('d-none');\n      }\n\n      console.log('Table data:', data); // Define the columns for the table.\n\n      var columnDefs = [{\n        field: 'full_name',\n        headerName: 'Name',\n        sortable: true,\n        filter: true\n      }, {\n        field: 'license.number',\n        headerName: 'License',\n        sortable: true,\n        filter: true\n      }, {\n        field: 'license.license_type',\n        headerName: 'Type',\n        sortable: true,\n        filter: true\n      }, {\n        field: 'license.start_date',\n        headerName: 'Start Date',\n        sortable: true,\n        filter: true\n      }, {\n        field: 'license.end_date',\n        headerName: 'End Date',\n        sortable: true,\n        filter: true\n      }]; // Specify the table options.\n\n      var gridOptions = {\n        columnDefs: columnDefs,\n        pagination: true,\n        paginationAutoPageSize: true,\n        suppressRowClickSelection: false,\n        onRowClicked: event => this.openObject('employee', event),\n        onGridReady: event => _settings_theme_js__WEBPACK_IMPORTED_MODULE_1__.theme.toggleTheme(_settings_theme_js__WEBPACK_IMPORTED_MODULE_1__.theme.getTheme())\n      }; // Render the table\n\n      var eGridDiv = document.querySelector(\"#\".concat(tableId));\n      new agGrid.Grid(eGridDiv, gridOptions);\n      gridOptions.api.setRowData(data);\n    });\n  }\n\n};\n/*---------------------------------------------------------------------\r\n Items\r\n --------------------------------------------------------------------*/\n\nvar items = {\n  getItems(tableId, orgId, licenseNumber, versionId) {\n    /* Get data from the API and in a table. */\n    // Get the data.\n    var query = \"license=\".concat(licenseNumber, \"&org_id=\").concat(orgId, \"&version_id=\").concat(versionId);\n    var url = \"/api/traceability/items?\".concat(query);\n    (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)(url).then(response => {\n      var {\n        data\n      } = response;\n\n      if (data) {\n        document.getElementById('data-placeholder').classList.add('d-none');\n        document.getElementById('data-table').classList.remove('d-none');\n      }\n\n      console.log('Table data:', data); // Define the columns for the table.\n\n      var columnDefs = [{\n        field: 'id',\n        headerName: 'ID',\n        sortable: true,\n        filter: true\n      }, {\n        field: 'name',\n        headerName: 'Name',\n        sortable: true,\n        filter: true\n      }, {\n        field: 'product_category_type',\n        headerName: 'Category',\n        sortable: true,\n        filter: true\n      }, {\n        field: 'default_lab_testing_state',\n        headerName: 'Testing Status',\n        sortable: true,\n        filter: true\n      }, {\n        field: 'unit_weight',\n        headerName: 'Weight',\n        sortable: true,\n        filter: true\n      }, {\n        field: 'unit_weight_unit_of_measure_name',\n        headerName: 'Units',\n        sortable: true,\n        filter: true\n      }]; // Specify the table options.\n\n      var gridOptions = {\n        columnDefs: columnDefs,\n        pagination: true,\n        paginationAutoPageSize: true,\n        suppressRowClickSelection: false,\n        onRowClicked: event => this.openObject('item', event),\n        onGridReady: event => _settings_theme_js__WEBPACK_IMPORTED_MODULE_1__.theme.toggleTheme(_settings_theme_js__WEBPACK_IMPORTED_MODULE_1__.theme.getTheme())\n      }; // Render the table\n\n      var eGridDiv = document.querySelector(\"#\".concat(tableId));\n      new agGrid.Grid(eGridDiv, gridOptions);\n      gridOptions.api.setRowData(data);\n    });\n  },\n\n  createItem() {\n    /* Create a given location. */\n  },\n\n  updateItem() {\n    /* Update a given location. */\n  },\n\n  deleteItem() {\n    /* Delete a given location. */\n  },\n\n  saveItem() {\n    /* Create or update a given location. */\n  },\n\n  exportItems() {\n    /* Export locations data to Excel (.xlsx or .csv). */\n  },\n\n  importItems() {\n    /* Import locations data from Excel (.xlsx or .csv). */\n  }\n\n};\n/*---------------------------------------------------------------------\r\n Lab Tests\r\n --------------------------------------------------------------------*/\n\nvar labTests = {\n  getLabTests(tableId, orgId, licenseNumber, versionId) {\n    /* Get data from the API and in a table. */\n    var query = \"license=\".concat(licenseNumber, \"&org_id=\").concat(orgId, \"&version_id=\").concat(versionId);\n    var url = \"/api/traceability/lab-tests?\".concat(query);\n    (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)(url).then(response => {\n      var {\n        data\n      } = response;\n\n      if (data) {\n        document.getElementById('data-placeholder').classList.add('d-none');\n        document.getElementById('data-table').classList.remove('d-none');\n      }\n\n      console.log('Table data:', data); // Define the columns for the table.\n\n      var columnDefs = [{\n        field: 'lab_test_result_id',\n        headerName: 'ID',\n        sortable: true,\n        filter: true\n      }, {\n        field: 'result_release_date_time',\n        headerName: 'Released At',\n        sortable: true,\n        filter: true\n      }, {\n        field: 'test_performed_date',\n        headerName: 'Test Date',\n        sortable: true,\n        filter: true\n      }, {\n        field: 'test_type_name',\n        headerName: 'Test',\n        sortable: true,\n        filter: true\n      }, {\n        field: 'test_result_level',\n        headerName: 'Result',\n        sortable: true,\n        filter: true\n      }, {\n        field: 'overall_passed',\n        headerName: 'Pass',\n        sortable: true,\n        filter: true\n      }, {\n        field: 'test_comment',\n        headerName: 'Notes',\n        sortable: true,\n        filter: true\n      }]; // Specify the table options.\n\n      var gridOptions = {\n        columnDefs: columnDefs,\n        pagination: true,\n        paginationAutoPageSize: true,\n        suppressRowClickSelection: false,\n        onRowClicked: event => this.openObject('lab-test', event, 's', 'lab_test_result_id'),\n        onGridReady: event => _settings_theme_js__WEBPACK_IMPORTED_MODULE_1__.theme.toggleTheme(_settings_theme_js__WEBPACK_IMPORTED_MODULE_1__.theme.getTheme())\n      }; // Render the table\n\n      var eGridDiv = document.querySelector(\"#\".concat(tableId));\n      new agGrid.Grid(eGridDiv, gridOptions);\n      gridOptions.api.setRowData(data);\n    });\n  },\n\n  createLabTest() {\n    /* Create a given lab test. */\n  },\n\n  updateLabTest() {\n    /* Update a given lab test. */\n  },\n\n  deleteLabTest() {\n    /* Delete a given lab test. */\n  },\n\n  saveLabTest() {\n    /* Create or update a given lab test. */\n  },\n\n  exportLabTests() {\n    /* Export lab test data to Excel (.xlsx or .csv). */\n  },\n\n  importLabTests() {\n    /* Import lab test data from Excel (.xlsx or .csv). */\n  }\n\n};\n/*---------------------------------------------------------------------\r\n Locations\r\n --------------------------------------------------------------------*/\n\nvar locations = {\n  getLocations(tableId, orgId, licenseNumber, versionId) {\n    /* Get data from the API and in a table. */\n    var query = \"license=\".concat(licenseNumber, \"&org_id=\").concat(orgId, \"&version_id=\").concat(versionId);\n    var url = \"/api/traceability/locations?\".concat(query);\n    (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)(url).then(response => {\n      var {\n        data\n      } = response;\n\n      if (data) {\n        document.getElementById('data-placeholder').classList.add('d-none');\n        document.getElementById('data-table').classList.remove('d-none');\n      }\n\n      console.log('Table data:', data); // Create column of permissions.\n\n      data.forEach(row => {\n        row.permissions = [];\n      });\n\n      for (var i in data) {\n        data[i].permissions = [];\n        if (data[i].for_harvests) data[i].permissions.push('Harvests');\n        if (data[i].for_packages) data[i].permissions.push('Packages');\n        if (data[i].for_plant_batches) data[i].permissions.push('Batches');\n        if (data[i].for_plants) data[i].permissions.push('Plants');\n      } // Define the columns for the table.\n\n\n      var columnDefs = [{\n        field: 'id',\n        headerName: 'ID',\n        sortable: true,\n        filter: true\n      }, {\n        field: 'name',\n        headerName: 'Name',\n        sortable: true,\n        filter: true\n      }, {\n        field: 'location_type_name',\n        headerName: 'Type',\n        sortable: true,\n        filter: true\n      }, {\n        field: 'location_type_id',\n        headerName: 'Type ID',\n        sortable: true,\n        filter: true\n      }, {\n        field: 'permissions',\n        headerName: 'Permissions',\n        sortable: true,\n        filter: true\n      }]; // Specify the table options.\n\n      var gridOptions = {\n        columnDefs: columnDefs,\n        pagination: true,\n        paginationAutoPageSize: true,\n        suppressRowClickSelection: false,\n        onRowClicked: event => this.openObject('location', event),\n        onGridReady: event => _settings_theme_js__WEBPACK_IMPORTED_MODULE_1__.theme.toggleTheme(_settings_theme_js__WEBPACK_IMPORTED_MODULE_1__.theme.getTheme())\n      }; // Render the table\n\n      var eGridDiv = document.querySelector(\"#\".concat(tableId));\n      new agGrid.Grid(eGridDiv, gridOptions);\n      gridOptions.api.setRowData(data);\n    });\n  },\n\n  createLocation() {\n    /* Create a given location. */\n  },\n\n  updateLocation() {\n    /* Update a given location. */\n  },\n\n  deleteLocation() {\n    /* Delete a given location. */\n  },\n\n  saveLocation() {\n    /* Create or update a given location. */\n  },\n\n  exportLocations() {\n    /* Export locations data to Excel (.xlsx or .csv). */\n  },\n\n  importLocations() {\n    /* Import locations data from Excel (.xlsx or .csv). */\n  }\n\n};\n/*---------------------------------------------------------------------\r\n Packages\r\n --------------------------------------------------------------------*/\n\nvar packages = {\n  getPackages(tableId, orgId, licenseNumber, versionId) {\n    /* Get data from the API and in a table. */\n    var query = \"license=\".concat(licenseNumber, \"&org_id=\").concat(orgId, \"&version_id=\").concat(versionId);\n    var url = \"/api/traceability/packages?\".concat(query);\n    (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)(url).then(response => {\n      var {\n        data\n      } = response;\n\n      if (data) {\n        document.getElementById('data-placeholder').classList.add('d-none');\n        document.getElementById('data-table').classList.remove('d-none');\n      }\n\n      console.log('Table data:', data); // Define the columns for the table.\n\n      var columnDefs = [{\n        field: 'id',\n        headerName: 'ID',\n        sortable: true,\n        filter: true\n      } // { field: 'name', headerName: 'Name', sortable: true, filter: true },\n      // { field: 'product_category_type', headerName: 'Category', sortable: true, filter: true },\n      // { field: 'default_lab_testing_state', headerName: 'Testing Status', sortable: true, filter: true },\n      // { field: 'unit_weight', headerName: 'Weight', sortable: true, filter: true },\n      // { field: 'unit_weight_unit_of_measure_name', headerName: 'Units', sortable: true, filter: true },\n      ]; // Specify the table options.\n\n      var gridOptions = {\n        columnDefs: columnDefs,\n        pagination: true,\n        paginationAutoPageSize: true,\n        suppressRowClickSelection: false,\n        onRowClicked: event => this.openObject('package', event),\n        onGridReady: event => _settings_theme_js__WEBPACK_IMPORTED_MODULE_1__.theme.toggleTheme(_settings_theme_js__WEBPACK_IMPORTED_MODULE_1__.theme.getTheme())\n      }; // Render the table\n\n      var eGridDiv = document.querySelector(\"#\".concat(tableId));\n      new agGrid.Grid(eGridDiv, gridOptions);\n      gridOptions.api.setRowData(data);\n    });\n  },\n\n  createPackage() {\n    /* Create a given location. */\n  },\n\n  updatePackage() {\n    /* Update a given location. */\n  },\n\n  deletePackage() {\n    /* Delete a given location. */\n  },\n\n  savePackage() {\n    /* Create or update a given location. */\n  },\n\n  exportPackages() {\n    /* Export locations data to Excel (.xlsx or .csv). */\n  },\n\n  importPackages() {\n    /* Import locations data from Excel (.xlsx or .csv). */\n  }\n\n};\n/*---------------------------------------------------------------------\r\n Strains\r\n --------------------------------------------------------------------*/\n\nvar strains = {\n  getStrains(tableId, orgId, licenseNumber, versionId) {\n    /* Get data from the API and in a table. */\n    var query = \"license=\".concat(licenseNumber, \"&org_id=\").concat(orgId, \"&version_id=\").concat(versionId);\n    var url = \"/api/traceability/strains?\".concat(query);\n    (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)(url).then(response => {\n      var {\n        data\n      } = response;\n\n      if (data) {\n        document.getElementById('data-placeholder').classList.add('d-none');\n        document.getElementById('data-table').classList.remove('d-none');\n      }\n\n      console.log('Table data:', data); // Define the columns for the table.\n\n      var columnDefs = [{\n        field: 'id',\n        headerName: 'ID',\n        sortable: true,\n        filter: true\n      }, {\n        field: 'name',\n        headerName: 'Name',\n        sortable: true,\n        filter: true\n      }, {\n        field: 'genetics',\n        headerName: 'Genetics',\n        sortable: true,\n        filter: true\n      }, {\n        field: 'indica_percentage',\n        headerName: 'Indica Percent',\n        sortable: true,\n        filter: true\n      }, {\n        field: 'sativa_percentage',\n        headerName: 'Sativa Percent',\n        sortable: true,\n        filter: true\n      }, {\n        field: 'testing_status',\n        headerName: 'Testing Status',\n        sortable: true,\n        filter: true\n      }, {\n        field: 'thc_level',\n        headerName: 'THC Level',\n        sortable: true,\n        filter: true\n      }, {\n        field: 'is_used',\n        headerName: 'In Use',\n        sortable: true,\n        filter: true\n      }]; // Specify the table options.\n\n      var gridOptions = {\n        columnDefs: columnDefs,\n        pagination: true,\n        paginationAutoPageSize: true,\n        suppressRowClickSelection: false,\n        onRowClicked: event => this.openObject('strain', event),\n        onGridReady: event => _settings_theme_js__WEBPACK_IMPORTED_MODULE_1__.theme.toggleTheme(_settings_theme_js__WEBPACK_IMPORTED_MODULE_1__.theme.getTheme())\n      }; // Render the table\n\n      var eGridDiv = document.querySelector(\"#\".concat(tableId));\n      new agGrid.Grid(eGridDiv, gridOptions);\n      gridOptions.api.setRowData(data);\n    });\n  },\n\n  createStrain() {\n    /* Create a given strain. */\n  },\n\n  updateStrain() {\n    /* Update a given strain. */\n  },\n\n  deleteStrain() {\n    /* Delete a given strain. */\n  },\n\n  saveStrain() {\n    /* Create or update a given strain. */\n  },\n\n  exportStrains() {\n    /* Export strain data to Excel (.xlsx or .csv). */\n  },\n\n  importStrains() {\n    /* Import strain data from Excel (.xlsx or .csv). */\n  }\n\n};\n/*---------------------------------------------------------------------\r\n Transfers\r\n --------------------------------------------------------------------*/\n\nvar transfers = {\n  getTransfers(tableId, orgId, licenseNumber, versionId) {\n    /* Get data from the API and in a table. */\n    var query = \"license=\".concat(licenseNumber, \"&org_id=\").concat(orgId, \"&version_id=\").concat(versionId);\n    var url = \"/api/traceability/transfers?\".concat(query);\n    (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)(url).then(response => {\n      var {\n        data\n      } = response;\n\n      if (data) {\n        document.getElementById('data-placeholder').classList.add('d-none');\n        document.getElementById('data-table').classList.remove('d-none');\n      }\n\n      console.log('Table data:', data); // Define the columns for the table.\n\n      var columnDefs = [{\n        field: 'id',\n        headerName: 'ID',\n        sortable: true,\n        filter: true\n      } // { field: 'name', headerName: 'Name', sortable: true, filter: true },\n      // { field: 'product_category_type', headerName: 'Category', sortable: true, filter: true },\n      // { field: 'default_lab_testing_state', headerName: 'Testing Status', sortable: true, filter: true },\n      // { field: 'unit_weight', headerName: 'Weight', sortable: true, filter: true },\n      // { field: 'unit_weight_unit_of_measure_name', headerName: 'Units', sortable: true, filter: true },\n      ]; // Specify the table options.\n\n      var gridOptions = {\n        columnDefs: columnDefs,\n        pagination: true,\n        paginationAutoPageSize: true,\n        suppressRowClickSelection: false,\n        onRowClicked: event => this.openObject('transfer', event),\n        onGridReady: event => _settings_theme_js__WEBPACK_IMPORTED_MODULE_1__.theme.toggleTheme(_settings_theme_js__WEBPACK_IMPORTED_MODULE_1__.theme.getTheme())\n      }; // Render the table\n\n      var eGridDiv = document.querySelector(\"#\".concat(tableId));\n      new agGrid.Grid(eGridDiv, gridOptions);\n      gridOptions.api.setRowData(data);\n    });\n  },\n\n  createTransfer() {\n    /* Create a given location. */\n  },\n\n  updateTransfer() {\n    /* Update a given location. */\n  },\n\n  deleteTransfer() {\n    /* Delete a given location. */\n  },\n\n  saveTransfer() {\n    /* Create or update a given location. */\n  },\n\n  exportTransfers() {\n    /* Export locations data to Excel (.xlsx or .csv). */\n  },\n\n  importTransfers() {\n    /* Import locations data from Excel (.xlsx or .csv). */\n  }\n\n};\n/*---------------------------------------------------------------------\r\n Main object\r\n --------------------------------------------------------------------*/\n\nvar traceability = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, employees), items), labTests), locations), packages), strains), transfers), {}, {\n  openObject(type, row) {\n    var plural = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 's';\n    var id_field = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'id';\n\n    /*\r\n     * View a selected object.\r\n     */\n    var url = \"/traceability/\".concat(type).concat(plural, \"/\").concat(type, \"?id=\").concat(row.data[id_field]);\n    localStorage.setItem(type, JSON.stringify(row.data));\n    window.location.href = url;\n  },\n\n  viewObject(type) {\n    /*\r\n     * View the data when navigating to a selected object.\r\n     */\n    var data = JSON.parse(localStorage.getItem(type));\n    (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.formDeserialize)(document.forms[\"\".concat(type, \"-form\")], data);\n    console.log('Observation data:', data);\n  },\n\n  deleteLicenseValidation(orgId, licenseNumber) {\n    /*\r\n     * Validate that a reason is present before deleting a license.\r\n     */\n    var deletionReason = document.getElementById('license-deletion-reason-input').value;\n\n    if (!deletionReason) {\n      var message = 'A deletion reason is required for quality control.';\n      (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.showNotification)('Deletion reason required', message, {\n        type: 'error'\n      });\n      return;\n    }\n\n    deleteLicense(orgId, licenseNumber, deletionReason);\n  },\n\n  deleteLicense(orgId, licenseNumber, message) {\n    /*\r\n     * Delete a license from an organization's data, saving a deletion reason.\r\n     */\n    var url = \"/api/traceability/delete-license?license=\".concat(licenseNumber, \"&org_id=\").concat(orgId);\n    (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)(url, {\n      deletion_reason: message\n    }).then(response => {\n      if (response.error) {\n        // Optional: Show better error messages.\n        (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.showNotification)('Deleting license failed', response.message, {\n          type: 'error'\n        });\n      } else {\n        window.location.href = '/traceability/settings'; // Optional: Show success message\n      }\n    });\n  },\n\n  saveLicenses(orgId) {\n    /*\r\n     * Save an organization's licenses.\r\n     * FIXME: Handle updating licenses.\r\n     */\n    // Get the licenses data.\n    // Optional: Split license data rows more elegantly.\n    var elements = document.getElementById('licenses-form').elements;\n    var licenses = [];\n    var data = {};\n\n    for (var i = 0; i < elements.length; i++) {\n      var item = elements.item(i);\n      if (item.name) data[item.name] = item.value;\n\n      if (item.name === 'user_api_key') {\n        licenses.push(data);\n        data = {};\n      }\n    } // Post the data.\n\n\n    (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.authRequest)(\"/api/organizations/\".concat(orgId), {\n      'licenses': licenses\n    }).then(response => {\n      console.log('Saved licenses:', response); // TODO: Show better error messages.\n      // TODO: Tell user if organization name is already taken\n\n      if (response.error) {\n        (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.showNotification)('Organization request failed', response.message, {\n          type: 'error'\n        });\n      } else {\n        // showNotification('Organization request sent', response.message, { type: 'success' });\n        // TODO: Re-render licenses.\n        location.reload();\n      }\n    });\n  }\n\n});\n\n//# sourceURL=webpack://cannlytics/./console/assets/js/traceability/traceability.js?")},"./console/assets/js/transfers/transfers.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"transfers\": () => (/* binding */ transfers)\n/* harmony export */ });\n/**\r\n * Logistics JavaScript | Cannlytics Console\r\n * Author: Keegan Skeate\r\n * Created: 12/9/2020\r\n * Updated: 6/3/2021\r\n * Resources:\r\n *    https://github.com/fullcalendar/fullcalendar-example-projects/blob/master/webpack/src/main.js\r\n *    https://fullcalendar.io/docs/handlers\r\n */\n// import { Calendar } from '@fullcalendar/core';\n// import interactionPlugin from '@fullcalendar/interaction';\n// import dayGridPlugin from '@fullcalendar/daygrid';\n// import timeGridPlugin from '@fullcalendar/timegrid';\n// import listPlugin from '@fullcalendar/list';\nvar transfers = {\n  initialize() {\n    console.log('Initializing logistics..'); // this.drawCalendar();\n\n    var script = document.createElement('script');\n    script.src = 'https://cdn.jsdelivr.net/npm/fullcalendar@5.4.0/main.min.js';\n    script.defer = true; // window.initMap = this.drawCalendar;\n\n    document.head.appendChild(script);\n    document.addEventListener('DOMContentLoaded', function () {\n      var calendarEl = document.getElementById('calendar');\n      var calendar = new FullCalendar.Calendar(calendarEl, {\n        initialView: 'dayGridMonth',\n        initialDate: '2020-12-07',\n        headerToolbar: {\n          left: 'prev,next today',\n          center: 'title',\n          right: 'dayGridMonth,timeGridWeek,timeGridDay'\n        },\n        events: [{\n          title: 'All Day Event',\n          start: '2020-12-01'\n        }, {\n          title: 'Long Event',\n          start: '2020-12-07',\n          end: '2020-12-10'\n        }, {\n          groupId: '999',\n          title: 'Repeating Event',\n          start: '2020-12-09T16:00:00'\n        }, {\n          groupId: '999',\n          title: 'Repeating Event',\n          start: '2020-12-16T16:00:00'\n        }, {\n          title: 'Conference',\n          start: '2020-12-11',\n          end: '2020-12-13'\n        }, {\n          title: 'Meeting',\n          start: '2020-12-12T10:30:00',\n          end: '2020-12-12T12:30:00'\n        }, {\n          title: 'Lunch',\n          start: '2020-12-12T12:00:00'\n        }, {\n          title: 'Meeting',\n          start: '2020-12-12T14:30:00'\n        }, {\n          title: 'Birthday Party',\n          start: '2020-12-13T07:00:00'\n        }, {\n          title: 'Click for Google',\n          url: 'http://google.com/',\n          start: '2020-12-28'\n        }]\n      });\n      calendar.render();\n    });\n  },\n\n  initializeLogs() {\n    console.log('Initialize logs...');\n  },\n\n  initializeAnalytics() {\n    console.log('Initialize analytics...');\n  },\n\n  initializeMap() {\n    var script = document.createElement('script');\n    var API_KEY = 'AIzaSyB-ZjpD7MgK9mMwxQgsyr5wh-4xciJzIHw'; // TODO: Get from Firestore.\n\n    script.src = \"https://maps.googleapis.com/maps/api/js?key=\".concat(API_KEY, \"&callback=initMap\");\n    script.defer = true;\n    window.initMap = this.drawMap;\n    document.head.appendChild(script);\n  },\n\n  drawCalendar() {\n    var calendarEl = document.getElementById('calendar');\n    if (!calendarEl) return;\n    var calendar = new Calendar(calendarEl, {\n      plugins: [interactionPlugin, dayGridPlugin, timeGridPlugin, listPlugin],\n      headerToolbar: {\n        left: 'prev,next today',\n        center: 'title',\n        right: 'dayGridMonth,timeGridWeek,timeGridDay,listWeek'\n      },\n      initialDate: '2020-12-10',\n      // TODO: Set current day.\n      navLinks: true,\n      // can click day/week names to navigate views\n      editable: true,\n      dayMaxEvents: true,\n      // allow \"more\" link when too many events\n      // TODO: Get events from Firestore.\n      events: [{\n        title: 'Meeting',\n        start: '2020-12-12T10:30:00',\n        end: '2020-12-12T12:30:00'\n      }],\n      dateClick: function dateClick() {\n        console.log('a day has been clicked!');\n      }\n    });\n    calendar.render();\n  },\n\n  drawMap() {\n    var locations = [[\"USA\", 39.8283, -98.5795, 1]]; // TODO: Get location of transfers from Firestore\n\n    var map = new google.maps.Map(document.getElementById('map'), {\n      zoom: 4,\n      center: new google.maps.LatLng(39.8283, -98.5795),\n      // TODO: Get organization's latitude and longitude\n      mapTypeId: google.maps.MapTypeId.ROADMAP\n    });\n    var infoWindow = new google.maps.InfoWindow();\n    var marker, i;\n\n    for (i = 0; i < locations.length; i++) {\n      marker = new google.maps.Marker({\n        position: new google.maps.LatLng(locations[i][1], locations[i][2]),\n        map: map\n      });\n      google.maps.event.addListener(marker, 'click', function (marker, i) {\n        return function () {\n          infoWindow.setContent(locations[i][0]);\n          infoWindow.open(map, marker);\n        };\n      }(marker, i));\n    }\n  }\n\n};\n\n//# sourceURL=webpack://cannlytics/./console/assets/js/transfers/transfers.js?")},"./console/assets/js/ui/ui.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval('__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   "ui": () => (/* binding */ ui)\n/* harmony export */ });\n/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils.js */ "./console/assets/js/utils.js");\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n/**\r\n * User Interface JavaScript | Cannlytics Console\r\n * Author: Keegan Skeate <contact@cannlytics.com>\r\n * Created: 5/2/2021\r\n * Updated: 6/10/2021\r\n */\n\nvar formHelpers = {\n  toggleFields(event, key) {\n    /*\r\n     * Hide or show additional form fields.\r\n     */\n    event.preventDefault();\n    this.toggleElementClass("".concat(key, "-fields"), \'d-none\');\n    this.toggleElementClass("".concat(key, "-fields-show"), \'d-none\');\n\n    try {\n      this.toggleElementClass("".concat(key, "-fields-hide"), \'d-none\');\n    } catch (error) {// No element to hide the form.\n    }\n  }\n\n};\nvar initHelpers = {\n  enableTooltips() {\n    /*\r\n     * FIXME: Enable all tooltips on a page.\r\n     * Uncaught ReferenceError: bootstrap is not defined\r\n     */\n    var tooltipTriggerList = [].slice.call(document.querySelectorAll(\'[data-bs-toggle="tooltip"]\'));\n    var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {\n      return new bootstrap.Tooltip(tooltipTriggerEl);\n    });\n    return tooltipList;\n  }\n\n};\nvar navigationHelpers = {\n  openObject(model, modelSingular, data) {\n    /*\r\n     * Navigate a selected object detail page, saving its data in local storage.\r\n     * It is assumed that data has a field named as the singular modal name +\r\n     * an underscore + the literal \'id\'. If no ID is provided, then navigate to\r\n     * a new page.\r\n     */\n    var id = \'new\';\n    var objectId = data["".concat(modelSingular, "_id")];\n    if (objectId) id = objectId;\n    localStorage.setItem(modelSingular, JSON.stringify(data));\n    window.location.href = "/".concat(model, "/").concat(id);\n  },\n\n  viewObject(modelSingular) {\n    /*\r\n     * View an object\'s data from local storage when navigating to a detail page.\r\n     */\n    var data = JSON.parse(localStorage.getItem(modelSingular));\n    (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.formDeserialize)(document.forms["".concat(modelSingular, "-form")], data);\n    console.log(\'DEV: Observation data:\', data);\n  }\n\n};\nvar ui = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, formHelpers), initHelpers), navigationHelpers), {}, {\n  hideSidebar() {\n    /*\r\n     * Hides the console sidebar.\r\n     */\n    var sidebar = document.getElementById(\'sidebar-menu\'); // const sidebarToggle = document.getElementById(\'sidebar-console-toggle\');\n\n    var navbarToggle = document.getElementById(\'navbar-menu-button\');\n    sidebar.classList.add(\'d-none\');\n    sidebar.classList.remove(\'d-md-block\'); // sidebarToggle.classList.remove(\'d-md-none\');\n\n    navbarToggle.classList.remove(\'d-md-none\');\n  },\n\n  showSidebar() {\n    /*\r\n     * Show the console sidebar.\r\n     */\n    var sidebar = document.getElementById(\'sidebar-menu\');\n    var sidebarToggle = document.getElementById(\'sidebar-console-toggle\');\n    sidebar.classList.remove(\'d-none\');\n    sidebar.classList.add(\'d-md-block\');\n    sidebarToggle.classList.add(\'d-md-none\');\n  },\n\n  toggleSidebarNestedNav(section) {\n    /*\r\n     * Toggle nested navigation in the sidebar.\r\n     */\n    var items = document.getElementById("".concat(section, "-items"));\n    var toggle = document.getElementById("".concat(section, "-toggle"));\n\n    if ((0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.hasClass)(items, \'show\')) {\n      items.classList.remove(\'show\');\n      toggle.classList.remove(\'flipped\');\n    } else {\n      items.classList.add(\'show\');\n      toggle.classList.add(\'flipped\');\n    }\n  },\n\n  addListItem(event, type) {\n    /*\r\n     * Adds a list item of input fields to the UI by\r\n     * cloning the primary list item and clearing its fields.\r\n     * The delete button is shown and wired-up.\r\n     * The tooltip is removed.\r\n     */\n    event.preventDefault();\n    var ul = document.getElementById("".concat(type, "-list"));\n    var li = document.getElementById("primary-".concat(type)).cloneNode(true);\n    var id = "".concat(type, "-").concat(ul.children.length + 1);\n    li.setAttribute(\'id\', id);\n    ul.appendChild(li);\n    $("#".concat(id, " input")).val(\'\');\n    $("#".concat(id, " .btn-tooltip-help")).remove();\n    var deleteButton = $("#".concat(id, " .btn-link"));\n    deleteButton.removeClass(\'d-none\');\n    deleteButton.attr(\'onClick\', "cannlytics.ui.removeListItem(event, \'".concat(type, "-list\', \'").concat(id, "\');"));\n  },\n\n  removeListItem(event, listId, elementId) {\n    /*\r\n     * Remove an element from a list.\r\n     */\n    event.preventDefault();\n    var ul = document.getElementById(listId);\n    var item = document.getElementById(elementId);\n    ul.removeChild(item);\n  },\n\n  toggleElementClass(id, className) {\n    /*\r\n     * Show or hide a given element.\r\n     */\n    var element = document.getElementById(id);\n    element.classList.toggle(className);\n  },\n\n  showLoadingButton(buttonId) {\n    /*\r\n     * Show a hidden loading button given the ID of its button counterpart.\r\n     */\n    document.getElementById(buttonId).classList.add(\'d-none\');\n    document.getElementById("".concat(buttonId, "-loading")).classList.remove(\'d-none\');\n  },\n\n  hideLoadingButton(buttonId) {\n    /*\r\n     * Hide a by-default hidden loading button given the ID of its button counterpart.\r\n     */\n    document.getElementById(buttonId).classList.add(\'d-none\');\n    document.getElementById("".concat(buttonId, "-loading")).classList.remove(\'d-none\');\n  }\n\n});\n\n//# sourceURL=webpack://cannlytics/./console/assets/js/ui/ui.js?')},"./console/assets/js/utils.js":(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"authRequest\": () => (/* binding */ authRequest),\n/* harmony export */   \"apiRequest\": () => (/* binding */ apiRequest),\n/* harmony export */   \"getCookie\": () => (/* binding */ getCookie),\n/* harmony export */   \"Password\": () => (/* binding */ Password),\n/* harmony export */   \"serializeForm\": () => (/* binding */ serializeForm),\n/* harmony export */   \"formSerialize\": () => (/* binding */ formSerialize),\n/* harmony export */   \"formDeserialize\": () => (/* binding */ formDeserialize),\n/* harmony export */   \"hasClass\": () => (/* binding */ hasClass),\n/* harmony export */   \"showNotification\": () => (/* binding */ showNotification),\n/* harmony export */   \"capitalize\": () => (/* binding */ capitalize),\n/* harmony export */   \"slugify\": () => (/* binding */ slugify)\n/* harmony export */ });\n/* harmony import */ var _firebase_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./firebase.js */ \"./console/assets/js/firebase.js\");\n/* harmony import */ var _firebase_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_firebase_js__WEBPACK_IMPORTED_MODULE_0__);\n/*\r\n * Utility JavaScript | Cannlytics Console\r\n * Author: Keegan Skeate <contact@cannlytics.com>\r\n * Created: 2/21/2021\r\n * Updated: 6/21/2021\r\n */\n\n/*---------------------------------------------------------------------\r\n Auth Helpers\r\n --------------------------------------------------------------------*/\n\nvar authRequest = (endpoint, data, options) => new Promise((resolve, reject) => {\n  /*\r\n   * Make an authorized GET or POST request by\r\n   * getting the user's ID token and exchanging it for a session cookie.\r\n   */\n  (0,_firebase_js__WEBPACK_IMPORTED_MODULE_0__.getUserToken)().then(idToken => {\n    apiRequest(endpoint, data, options, idToken).then(data => resolve(data)).catch(error => reject(error));\n  }).catch(error => reject(error));\n});\nvar apiRequest = function apiRequest(endpoint, data, options) {\n  var idToken = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;\n  return new Promise((resolve, reject) => {\n    /*\r\n     * Make a request to the Cannlytics API, with an ID token for authentication\r\n     * or without ID token when the user already has an authenticated session.\r\n     * CSRF protection is taken into account.\r\n     */\n    var csrftoken = getCookie('csrftoken');\n    var headerAuth = new Headers({\n      'Content-Type': 'application/json',\n      'Authorization': \"Bearer \".concat(idToken),\n      'X-CSRFToken': csrftoken\n    });\n    var init = {\n      headers: headerAuth,\n      // credentials: 'include',\n      // mode: 'same-origin',\n      method: 'GET'\n    };\n\n    if (data) {\n      init.method = 'POST';\n      init.body = JSON.stringify(data);\n    }\n\n    if (options) {\n      if (options.delete) {\n        init.method = 'DELETE';\n      }\n\n      if (options.params) {\n        endpoint = new URL(endpoint);\n        endpoint.search = new URLSearchParams(options.params).toString();\n      }\n    }\n\n    fetch(window.location.origin + endpoint, init).then(response => response.json()).catch(error => reject(error)).then(data => resolve(data)).catch(error => reject(error));\n  });\n};\nfunction getCookie(name) {\n  /*\r\n   * Get a cookie by name.\r\n   */\n  var cookieValue = null;\n\n  if (document.cookie && document.cookie !== '') {\n    var cookies = document.cookie.split(';');\n\n    for (var i = 0; i < cookies.length; i++) {\n      var cookie = cookies[i].trim();\n\n      if (cookie.substring(0, name.length + 1) === name + '=') {\n        cookieValue = decodeURIComponent(cookie.substring(name.length + 1));\n        break;\n      }\n    }\n  }\n\n  return cookieValue;\n}\nvar Password = {\n  /*\r\n   * Class use to generate random passwords.\r\n   * Usage: Password.generate(32)\r\n   */\n  _pattern: /[a-zA-Z0-9_\\-\\+\\.]/,\n  _getRandomByte: function _getRandomByte() {\n    // http://caniuse.com/#feat=getrandomvalues\n    if (window.crypto && window.crypto.getRandomValues) {\n      var result = new Uint8Array(1);\n      window.crypto.getRandomValues(result);\n      return result[0];\n    } else if (window.msCrypto && window.msCrypto.getRandomValues) {\n      var result = new Uint8Array(1);\n      window.msCrypto.getRandomValues(result);\n      return result[0];\n    } else {\n      return Math.floor(Math.random() * 256);\n    }\n  },\n  generate: function generate(length) {\n    return Array.apply(null, {\n      'length': length\n    }).map(function () {\n      var result;\n\n      while (true) {\n        result = String.fromCharCode(this._getRandomByte());\n\n        if (this._pattern.test(result)) {\n          return result;\n        }\n      }\n    }, this).join('');\n  }\n};\n/*---------------------------------------------------------------------\r\n Form Helpers\r\n --------------------------------------------------------------------*/\n\nfunction serializeForm(elementId) {\n  var keepAll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n\n  /*\r\n   * Get a data object from a form, by default excluding empty fields.\r\n   */\n  var elements = document.getElementById(elementId).elements;\n  var data = {};\n\n  for (var i = 0; i < elements.length; i++) {\n    var item = elements.item(i);\n    if (item.name || keepAll) data[item.name] = item.value;\n  }\n\n  return data;\n}\nfunction formSerialize(form) {\n  /* Get data from a form. */\n  var data = new FormData(form); //https://stackoverflow.com/a/44033425/1869660\n\n  return new URLSearchParams(data).toString();\n}\nfunction formDeserialize(form, data) {\n  /* Populate a form given data. */\n  var entries = new URLSearchParams(data).entries();\n\n  for (var [key, val] of entries) {\n    //http://javascript-coder.com/javascript-form/javascript-form-value.phtml\n    var input = form.elements[key];\n\n    if (input) {\n      switch (input.type) {\n        case 'checkbox':\n          input.checked = !!val;\n          break;\n\n        default:\n          input.value = val;\n          break;\n      }\n    }\n  }\n}\n/*---------------------------------------------------------------------\r\n UI Helpers\r\n --------------------------------------------------------------------*/\n\nfunction hasClass(element, className) {\n  /*\r\n   * Check if an element has a class.\r\n   */\n  return (' ' + element.className + ' ').indexOf(' ' + className + ' ') > -1;\n}\nfunction showNotification(title, message, options) {\n  /*\r\n   * Show an error notification.\r\n   */\n  var toastEl = document.getElementById('notification-toast');\n  document.getElementById('notification-title').textContent = title;\n  document.getElementById('notification-message').textContent = message;\n  toastEl.classList.remove('d-none');\n\n  if (options.type) {\n    var types = ['error', 'success', 'wait'];\n    types.forEach(type => {\n      if (type === options.type) {\n        document.getElementById(\"notification-\".concat(type, \"-icon\")).classList.remove('d-none');\n      } else {\n        document.getElementById(\"notification-\".concat(type, \"-icon\")).classList.add('d-none');\n      }\n    });\n  }\n\n  var toast = new bootstrap.Toast(toastEl, {\n    delay: options.delay || 4000\n  });\n  toast.show();\n}\n/*---------------------------------------------------------------------\r\n Text Helpers\r\n --------------------------------------------------------------------*/\n\nfunction capitalize(string) {\n  /*\r\n   * Capitalize the first letter of a given string.\r\n   * Reference: https://www.geeksforgeeks.org/how-to-make-first-letter-of-a-string-uppercase-in-javascript/\r\n   */\n  return string.replace(/^./, string[0].toUpperCase());\n}\nfunction slugify(text) {\n  /*\r\n   * Turn a string to a slug.\r\n   * Reference: https://stackoverflow.com/questions/1053902/how-to-convert-a-title-to-a-url-slug-in-jquery\r\n   */\n  return text.toLowerCase().replace(/[^\\w ]+/g, '').replace(/ +/g, '-');\n}\n\n//# sourceURL=webpack://cannlytics/./console/assets/js/utils.js?")}},__webpack_module_cache__={};function __webpack_require__(e){var n=__webpack_module_cache__[e];if(void 0!==n)return n.exports;var t=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e](t,t.exports,__webpack_require__),t.exports}__webpack_require__.n=e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(n,{a:n}),n},__webpack_require__.d=(e,n)=>{for(var t in n)__webpack_require__.o(n,t)&&!__webpack_require__.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:n[t]})},__webpack_require__.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__=__webpack_require__("./console/assets/js/index.js");cannlytics=__webpack_exports__})();